Basic Linux Commands

Linux Commands Cheat Sheet: Essential Commands for Every User

Explore our extensive Linux Commands Cheat Sheet, covering essential commands for beginners and advanced users. From file management to system monitoring, learn the commands you need to master Linux. Perfect for quick reference and boosting your Linux skills.

CommandDescription
dateDisplays the current time and date
calDisplays the current month’s calendar
dfShows the current amount of free space on disk drives
freeDisplays the amount of free memory
exitEnds a terminal session or logs out from the current user session
pwdPrints the current working directory
lsLists directory contents
cdChanges the directory
cd ~Changes the directory to the previous working directory
cd ..Moves one directory back
cd User_NameMoves to the specified user’s home directory
ls /pathLists directory contents for a specific path
ls -lLists directory contents in long format
ls -aLists all files, including hidden files
ls -ALists all files except . and ..
ls -dLists the contents of directories, not the directories themselves
ls -FAppends indicator characters to each listed name to denote file types
ls -hDisplays file sizes in a human-readable format
ls -rLists directory contents in reverse order
ls -SSorts results by file size
ls -tSorts results by last modified time
file filenameDetermines and prints the file type of a specified file
cpCopies files and directories
mvMoves or renames files and directories
mkdirCreates directories
rmRemoves files
rmdirRemoves empty directories
lnCreates hard and symbolic links
mkdir Folder1 Folder2Creates multiple directories
cp -aCopies files and directories along with their attributes
cp -iPrompts for confirmation before overwriting files
cp -rRecursively copies entire directories
cp -uCopies files only if the source is newer
mv -iPrompts for confirmation before overwriting files
mv -uMoves or renames files only if the source is newer
touchCreates a new empty file or updates the timestamp of a file
catConcatenates and displays the content of files
moreViews the content of a file one screen at a time
lessViews the content of a file, allowing backward movement in the file
headDisplays the first 10 lines of a file by default
tailDisplays the last 10 lines of a file by default
tail -fFollows the content of a file as it grows, useful for monitoring log files
echoDisplays a line of text or variables
grepSearches text using patterns
findSearches for files and directories within a directory hierarchy
locateFinds files by name using a pre-built database
duEstimates file space usage
chmodChanges file mode (permissions)
chownChanges file owner and group
statDisplays detailed information about a file or file system
df -hDisplays disk space usage in human-readable format
psDisplays currently running processes
topDisplays tasks running on the system in real-time
killSends a signal to terminate a process
killallTerminates all processes with a specified name
pkillSends a signal to a process based on name and other attributes
serviceManages services (start, stop, restart, status)
systemctlControls the systemd system and service manager
journalctlViews logs collected by systemd
whoamiDisplays the current logged-in user’s username
hostnameDisplays or sets the system’s hostname
unameDisplays system information
uptimeShows how long the system has been running
rebootReboots the system
shutdownShuts down or reboots the system
pingSends ICMP ECHO_REQUEST to network hosts
tracerouteDisplays the route packets take to a network host
curlTransfers data from or to a server, supports multiple protocols
wgetDownloads files from the web
scpSecurely copies files between hosts over a network
rsyncSynchronizes files and directories between two locations
tarArchives files into a single file or extracts them
gzipCompresses files using the gzip algorithm
gunzipDecompresses files compressed with gzip
zipCompresses files into a zip archive
unzipExtracts files from a zip archive
bzip2Compresses files using the bzip2 algorithm
bunzip2Decompresses files compressed with bzip2
aliasCreates a shortcut for a command
unaliasRemoves an alias
historyDisplays the command history
envDisplays the environment variables
exportSets environment variables
unsetUnsets or removes a variable
sudoExecutes a command as another user, typically the superuser
suSwitches to another user account
passwdChanges the user’s password
df -TDisplays the file system type along with disk space usage
df -iDisplays inode information along with disk space usage
mountMounts a file system
umountUnmounts a file system
lsblkLists information about block devices
blkidDisplays block device attributes, such as UUID and file system type
fdiskManipulates disk partition tables
partedA partition editor to create, delete, resize, and manage disk partitions
mkfsCreates a file system on a partition
fsckChecks and repairs a Linux file system
ddConverts and copies files, useful for creating bootable USB drives
whoDisplays who is currently logged in
wDisplays who is logged in and what they are doing
lastShows the last login sessions of users
clearClears the terminal screen
df -hDisplays disk usage in human-readable format
df -TDisplays the file system type
touchCreates a new, empty file
whichLocates the path of an executable file
whereisLocates the binary, source, and manual page files for a command
timeMeasures the duration of command execution
bgResumes a suspended job in the background
fgBrings a background job to the foreground
jobsLists active jobs
nohupRuns a command immune to hangups (keep running even after logging out)
sleepDelays for a specified amount of time
waitWaits for a process to complete
xargsConstructs argument list(s) and executes a command
diffCompares the contents of two files line by line
cmpCompares two files byte by byte
commCompares two sorted files line by line
sortSorts lines of text files
uniqReports or omits repeated lines
cutRemoves sections from each line of files
pasteMerges lines of files
trTranslates or deletes characters from a stream
sedStream editor for filtering and transforming text
awkPattern scanning and processing language

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top