A practical cheat sheet for beginners and semi-pros. Organized by use case, with explanations, common flags, and an example for every command.

ls List files and directoriesCommon flags: -l (long listing), -a (show hidden files), -h (human-readable sizes), -t (sort by time), -R (recursive)
Example: ls -lah — detailed listing with hidden files and readable sizes; ls -lt — newest files first
cd Change directoryExample: cd ~ — go to your home directory; cd - — go back to the previous directory; cd .. — go up one level
pwd Show the current directory (print working directory)Example: pwd
mkdir Create a directoryrmdir Remove an empty directoryrm Remove files/directoriescp Copy files/directoriesmv Move or rename filestouch Create an empty file / update its timestampfind Search a directory tree for fileslocate Fast file search using a prebuilt indextree Show the directory structure graphicallyln Create linksstat Detailed file informationfile Identify a file's typedu Show disk usage for files/directoriesdf Show disk space for filesystemscat Show file contents / concatenate filesExample: cat file1.txt file2.txt > merged.txt
less Page through files one screen at a timeExample: less big_log.txt (page with space, search with /)
more Simpler predecessor to lessExample: more file.txt
head Show the first lines of a filetail Show the last lines of a filenano Simple terminal text editorvim Powerful terminal text editortee Write output to both the screen and a filewc Count lines, words, bytes, and charactersdiff Compare two filescmp Compare files byte by bytesort Sort linesuniq Remove duplicate lines (requires sorted input)cut Cut out columns/fields from textpaste Merge lines from multiple files side by sidetr Replace or delete characterssplit Split a large file into smaller piecesgrep Search for text patterns in filesCommon flags: -i (case-insensitive), -r (recursive), -n (show line numbers), -v (invert, show non-matching lines)
Example: grep -rn "TODO" src/ — find all TODO comments with line numbers; grep -i "error" log.txt
egrep / grep -E Search using extended regular expressionsExample: egrep "error|warning" log.txt
fgrep / grep -F Search for an exact text string (no regex)Example: fgrep "192.168.1.1" access.log
sed Stream editor for text (search & replace, etc.)awk Powerful column-based text-processing toolxargs Build and run commands from inputecho Print textprintf Formatted text outputrev Reverse the characters in each linefold Wrap long text at a given widthcolumn Format text into neat columnsjq Powerful tool for processing JSONchmod Change file permissionsCommon flags: symbolic (u+x, g-w) or numeric (755, 644)
Example: chmod +x script.sh — make the file executable; chmod 644 file.txt — read/write for the owner, read-only for others
chown Change a file's ownerExample: chown anna:developers file.txt
chgrp Change a file's groupExample: chgrp developers file.txt
umask Default permissions for new filessudo Run a command as another user (usually root)su Switch user in the current shellid Show user/group IDswhoami Show the current usernamegroups Show which groups a user belongs tops Show running processesCommon flags: aux (all processes, detailed)
Example: ps aux | grep nginx
top Live monitoring of processes and resource usageExample: top (press q to quit)
htop An improved, interactive version of topExample: htop
kill Terminate a process by PIDkillall Terminate processes by namepkill Terminate processes matching a patternpgrep Find the PID of processes by namebg Send a paused process to the backgroundfg Bring a background process to the foregroundjobs List active background jobsnice Start a process with a given priorityrenice Change the priority of a running processnohup Run a command that keeps running after you log outwait Wait for background processes to finishtime Measure how long a command takesuname Show system informationCommon flags: -a (all)
Example: uname -a
uptime Show how long the system has been running plus loadExample: uptime
free Show memory usageCommon flags: -h (readable)
Example: free -h
vmstat Statistics on memory, processes, and I/Oiostat Disk I/O statisticslscpu Show CPU informationlsblk List block devices (disks/partitions)dmesg Show the kernel's message buffer (e.g. hardware errors)journalctl Read systemd logswho Show logged-in usersw Show logged-in users and what they're doinglast Show login historydate Show or set the date/timecal Show a calendarhostnamectl Show/change the hostname (systemd)ping Test whether a host is reachableExample: ping -c 4 google.com
curl Fetch/send data via URLsCommon flags: -I (headers only), -o (save to file), -X (HTTP method)
Example: curl -X POST -d "name=Anna" https://api.example.com/users
wget Download files from the webExample: wget https://example.com/file.zip
ssh Securely connect to another computer remotelyscp Copy files securely over SSHrsync Efficient file/directory synchronizationnetstat Show network connections (older tool)ss Modern replacement for netstatip Manage network interfaces and routing (modern Linux)ifconfig Show/configure network interfaces (older tool)traceroute Show the path packets take to a hostdig Look up DNS informationnslookup Simpler DNS lookupwhois Look up domain/IP ownership informationnc (netcat) Read/write raw data over the network, port troubleshootingiptables Manage firewall rules (older, but still common)hostname Show or set the computer's hostnameapt / apt-get Package management on Debian/UbuntuExample: sudo apt update && sudo apt upgrade — refresh package lists and upgrade installed packages; sudo apt install htop; sudo apt remove htop
dpkg Low-level package management on Debian-based systemsExample: dpkg -l | grep nginx
yum Package management on older RHEL/CentOSExample: sudo yum install htop
dnf Modern successor to yum (Fedora/RHEL)pacman Package management on Arch Linuxsnap Universal packages (Snapcraft)mount Mount a filesystemExample: sudo mount /dev/sdb1 /mnt/usb
umount Unmount a filesystemExample: sudo umount /mnt/usb
fdisk Partition hard drivesExample: sudo fdisk -l — list partitions
mkfs Create a filesystem on a partitionfsck Check and repair a filesystemblkid Show UUID and filesystem type for block devicestar Archive (and optionally compress) filesCommon flags: -c (create), -x (extract), -v (verbose), -z (gzip), -f (filename)
Example: tar -czvf archive.tar.gz folder/ — create a compressed archive; tar -xzvf archive.tar.gz — unpack it
zip Create a zip archiveExample: zip -r archive.zip folder/
unzip Unpack a zip archiveExample: unzip archive.zip
gzip / gunzip Compress/decompress individual filesbzip2 Alternative compression method, often a better ratioxz Modern compression with a high compression ratio7z 7-Zip archiving (requires p7zip)useradd Create a new userExample: sudo useradd -m anna (-m creates a home directory)
userdel Remove a userExample: sudo userdel -r anna (-r also removes the home directory)
usermod Modify an existing userExample: sudo usermod -aG sudo anna — add anna to the sudo group
passwd Change a passwordadduser An interactive, user-friendly alternative to useraddgroupadd Create a new groupchpasswd Bulk-update passwords from a file/scriptexport Set an environment variableExample: export PATH=$PATH:/opt/my-tool/bin
alias Create a shortcut for a commandExample: alias ll='ls -lah'
unalias Remove an aliasExample: unalias ll
history Show command historysource Run a script file in the current shell (e.g. to load variables)env Show environment variables / run a command in a clean environmentwhich Show the path to a command's executablewhereis Find the binary, source, and man pages for a commandtype Show how a command would be interpreted (alias, function, binary)man Read manual pageschsh Change your default shellcrontab Schedule recurring jobsbash / sh Run a shell scriptxdg-open Open a file/URL with the default program (Linux desktop)watch Run a command repeatedly and show the result livesleep Pause for a given number of seconds (handy in scripts)clear Clear the terminal windowexit End the terminal sessionreboot Restart the systemshutdown Shut down the systemsystemctl Manage systemd servicesservice Older way to manage services (works via a systemd wrapper)
Related guides: 100+ Bash Scripting Tricks, 100 Unusual & Obscure Linux Commands. From the books: The Linux Testament for the whole of Linux. All free guides are in the library.