quick referencealways safe to read, labelled when not
The cheat sheet
Everyday commands with a note on what each one actually does. Commands marked read-only can't change anything. Run those as freely as you like.
Getting your bearings
pwdWhere am I? Prints the folder you're standing in. Read-only.
ls -lhWhat's here? Lists files with sizes in human units (the h). Read-only.
cd ~/DownloadsGo somewhere. ~ is shorthand for your home folder. cd .. goes up; plain cd goes home.
man cpRead the manual for any command (here: cp). Scroll with arrows, leave with q. Read-only.
Files
cp file.txt file-backup.txtCopy. Source first, destination second. Add -r to copy a whole folder.
mv file.txt ~/Documents/Move, and also rename: mv old.txt new.txt. Same verb, both jobs.
rm file.txtDelete. Permanently. No recycle bin. Read the filename twice; there is no undo.
find ~ -name "*.pdf" -mtime -7Find files: every PDF in your home folder modified in the last 7 days. Read-only.
grep -ri "invoice" ~/DocumentsSearch inside files for a word, ignoring case (i), through subfolders (r). Read-only.
Installing & updating
sudo apt update && sudo apt upgradeUpdate everything (Ubuntu/Mint/Debian): refresh the catalog, then install what's new. Asks for your password.
sudo apt install vlcInstall a program by name (here: VLC). sudo apt remove vlc uninstalls it.
sudo dnf upgradeFedora's version of update-everything. Install with sudo dnf install vlc.
apt search "image editor"Find software when you don't know the package name. Read-only. Searching installs nothing.
Disks & space
df -hHow full are my drives? Shows each disk and its free space in human units. Read-only.
du -sh ~/DownloadsHow big is this folder? One summarized (s), human-readable (h) total. Read-only.
lsblkWhat drives are plugged in? Lists disks, partitions and where they're mounted. Handy for USB sticks. Read-only.
Network
ping -c 4 freelinuxhelp.comAm I online? Sends 4 test packets. Replies = you're connected; unknown host with working Wi-Fi = DNS trouble. Read-only.
nmcli device wifi listWhat networks can I see? Asks NetworkManager for nearby Wi-Fi. Read-only. (Wi-Fi missing entirely? Ticket #0001.)
ip aWhat's my IP address? Lists network interfaces and their addresses. Read-only.
Processes & power
topWhat's eating my CPU? Live view of running programs. Leave with q. Read-only.
pkill -f firefoxForce-quit a frozen app by name. Unsaved work in that app is lost. It's the "end task" of last resort.
systemctl status NetworkManagerIs a service running? Health report for any background service. Read-only; swap in restart (with sudo) to kick it.
sudo rebootRestart the machine. sudo poweroff shuts it down instead. Save your work first.
When it breaks
journalctl -p err -bShow me the errors (-p err) from this boot (-b). The system's diary. Read-only, and the first thing to check when something misbehaves.
dmesg | tail -n 30What did the kernel just say? The last 30 hardware-level messages. Plug in the misbehaving device, then run this. Needs sudo on some distros. Read-only.
uname -rWhich kernel am I on? Useful when a forum asks. And they will ask. Read-only.
resetTerminal showing garbage? Redraws it clean. Cosmetic, always safe.
nothing matches that filter. Try a shorter word, or clear it.