Every command here appears in the chapters. Use this as a fast lookup once concepts are familiar. A leading sudo indicates administrative rights are required.
Navigation & Files
Command
What it does
pwd
Print the current directory.
ls -lah
List all files, long form, human-readable sizes.
cd – / cd ~
Previous directory / home directory.
cp -r src dst
Copy (recursively for directories).
mv a b
Move or rename.
rm -i / rm -r
Remove (prompt) / remove a directory tree.
mkdir -p a/b/c
Create a nested directory tree.
ln -s target link
Create a symbolic link.
Viewing & Searching Text
Command
What it does
cat / less file
Show a file / page through it (q to quit).
head -n N / tail -n N
First / last N lines.
tail -f file
Follow a file live.
grep -ri term path
Recursive, case-insensitive content search.
grep -v ‘^#’ file
Show non-comment lines.
sed ‘s/old/new/g’ f
Stream search-and-replace.
awk ‘{print $1}’ f
Print the first field of each line.
sort | uniq -c | sort -rn
Count and rank duplicates.
Permissions & Ownership
Command
What it does
ls -l / ls -Z
Show permissions / SELinux context.
chmod 644 / 755 / 600
Common file / dir / secret modes.
chmod u+x file
Add execute for the owner.
chown -R user:group path
Recursively set ownership.
chmod 2775 dir
Setgid shared directory.
Users, Groups & Privilege
Command
What it does
id / groups
Show your IDs and group memberships.
sudo useradd -m -s /bin/bash u
Create a user with a home + shell.
sudo passwd u
Set a user’s password.
sudo usermod -aG group u
Append a user to a group.
sudo userdel -r u
Remove a user and their home.
sudo visudo
Safely edit sudo privileges.
Packages
Command
What it does
sudo apt update && sudo apt install -y pkg
Refresh and install (Ubuntu/Debian).
sudo dnf install pkg
Install (Rocky/Alma/RHEL).
apt search / dnf search term
Find a package.
sudo apt upgrade -y / sudo dnf upgrade -y
Apply updates.
sudo apt purge pkg
Remove a package and its config.
Processes & Services
Command
What it does
ps aux –sort=-%cpu | head
Top CPU processes.
top / htop
Live process view.
kill PID / kill -9 PID
Polite / forceful stop.
pgrep name / pkill name
Find / signal by name.
sudo systemctl enable –now svc
Start now and at boot.
systemctl status svc
Service state + recent logs.
journalctl -u svc -e / -f
Service logs: end / follow.
Networking
Command
What it does
ip addr / ip route
Interfaces / routing.
ss -tulpn
Listening ports + processes.
dig name +short
Resolve a name to an IP.
ping -c 4 host
Test reachability.
curl -I url
Check a web service responds.
nc -zv host port
Test a TCP port.
Storage & Archives
Command
What it does
lsblk / blkid
Block devices / UUIDs.
df -h / du -sh path
Free space / directory size.
sudo mkfs.ext4 /dev/sdXN
Create an ext4 filesystem (erases!).
sudo mount -a
Mount all fstab entries (test).
tar -czf a.tgz dir / tar -xzf a.tgz
Create / extract a gzip archive.
rsync -a –delete src/ dst/
Mirror a directory.
Scripting & Scheduling
Command
What it does
#!/bin/bash
Shebang — selects the interpreter.
set -euo pipefail
Strict mode for safe scripts.
chmod +x script.sh
Make a script executable.
crontab -e / crontab -l
Edit / list scheduled jobs.
systemctl list-timers
List systemd timers.
ENTERPRISE PRACTICE
Pair this reference with man pages and –help for authoritative, version-specific detail on any command.