Cheat Sheet
Every essential command, one page. Bookmark it, or print it and pin it above your desk.
Navigation & files
| Command | What it does |
|---|---|
pwd | Show the folder you're currently in |
ls / ls -la | List files · detailed list incl. hidden ones |
cd folder / cd .. / cd ~ | Enter folder · go up one level · go home |
mkdir -p a/b | Create folder(s), parents included |
rmdir folder | Remove an empty folder |
cp a b / cp -r dir dst | Copy a file · copy a folder recursively |
mv a b | Move or rename files/folders |
rm file / rm -r dir | Delete a file · delete a folder (no trash!) |
touch file | Create an empty file (or update its timestamp) |
cat file / less file | Print whole file · scroll through it (q quits) |
head file / tail -f log | First 10 lines · last 10 lines, live-following |
Search & help
| Command | What it does |
|---|---|
man ls | Full manual page for a command |
ls --help | Quick built-in summary |
grep -i "error" file | Find text in a file, ignoring case |
grep -r "todo" ~/code | Search text in every file of a folder |
find ~ -name "*.pdf" | Find files by name pattern |
which python3 | Where a command's program lives |
history | Your recently typed commands |
System info
| Command | What it does |
|---|---|
uname -r / uname -a | Kernel version · full system info |
df -h | Free disk space, human-readable |
du -sh folder | Total size of a folder |
free -h | RAM usage |
top / htop | Live process list (q quits) |
whoami / who | Your username · who's logged in |
uptime | How long since last reboot |
Permissions & admin
| Command | What it does |
|---|---|
sudo cmd | Run one command as root (asks your password) |
sudo !! | Re-run the previous command, but with sudo |
chmod +x script.sh | Make a script executable |
chmod 644 file | Owner: read+write · everyone else: read |
chmod 600 key | Owner-only access (SSH keys, secrets) |
chown alex file | Change a file's owner |
Remember the permission math: r=4, w=2, x=1. So 7 = rwx, 6 = rw-, 5 = r-x, 4 = r--.
Package managers compared
| Manager | Family | Install | Remove | Update everything | Search |
|---|---|---|---|---|---|
apt |
Debian · Ubuntu · Mint | sudo apt install pkg |
sudo apt remove pkg |
sudo apt update && sudo apt upgrade |
apt search x |
pacman |
Arch · Manjaro | sudo pacman -S pkg |
sudo pacman -Rns pkg |
sudo pacman -Syu |
pacman -Ss x |
dnf |
Fedora · RHEL | sudo dnf install pkg |
sudo dnf remove pkg |
sudo dnf upgrade |
dnf search x |
flatpak |
Universal | flatpak install app |
flatpak uninstall app |
flatpak update |
flatpak search x |
snap |
Universal (Ubuntu default) | sudo snap install app |
sudo snap remove app |
sudo snap refresh |
snap find x |
Where things live
| Path | What lives there |
|---|---|
/home/you | Your files & personal settings — your kingdom |
/etc | System-wide configuration files |
/var/log | System and app logs — first stop when debugging |
/usr/bin | Installed programs |
/tmp | Temporary files (cleared on reboot) |
/root | Root user's home — locked to you |
/media / /mnt | Where USB drives appear |
Terminal superpowers
| Shortcut | Magic |
|---|---|
Tab | Autocomplete commands, files and folders |
↑ / ↓ | Walk through your command history |
Ctrl + C | Stop a running command |
Ctrl + L | Clear the screen |
Ctrl + R | Search your history interactively |
Ctrl + Shift + C / V | Copy / paste in most terminals |
exit | Close the shell |
Keep this page nearby
You've seen the whole map now — the terminal will feel like home sooner than you think.