Free tool · No sign-up
Shell Command Cheat Sheet
The 40 commands you'll use most when running a server, all in one place. Every command is one-click copyable, and below are 7 animated terminal demos — watch how a command runs first, then type it yourself.
Small print: terminal demos show simulated output, but the commands are real — just type them. IPs and paths in the demos are examples.
Files & Directories5 commands
pwdShow which directory you're in — run this first when you're lost
ls -lahList files with details: permissions, sizes, timestamps
cd /var/wwwSwitch to a directory; cd - takes you back to the previous one
mkdir -p /var/www/myappCreate a directory; -p creates missing parents along the way
cp -r old/ new/Copy a whole directory — back up configs with this before editing
View & Search Text5 commands
cat CaddyfilePrint a small file's whole content at once
less /var/log/syslogBrowse big files: space to page, / to search, q to quit — safer than cat
grep -rn "TODO" .Recursively search all files under this directory for TODO; -n shows line numbers
grep -i "error" app.logCase-insensitive search for error — the go-to when hunting log failures
tail -n 50 app.logShow the last 50 lines of a file; you usually only care about the tail of logs
Permissions & Users5 commands
chmod 600 ~/.ssh/id_ed25519Private keys must be readable only by you, or SSH refuses to use them
chmod +x deploy.shMake a script executable so you can run it with ./deploy.sh
chown -R www-data:www-data /var/wwwHand your website directory back to the user running the site
sudo -iTemporarily become root — safer than logging in as root all the time
adduser deployCreate a regular user for daily work; stop doing everything as root
Processes & System6 commands
ps aux | grep nodeFind running node processes — confirm the service is actually up
kill 812Politely end a process (replace 812 with the PID from ps); use kill -9 only if that fails
topWatch in real time who's eating CPU and memory; press q to quit
df -hCheck remaining disk space — look here first when the site returns 500
free -hCheck memory usage; build failures on tiny 1-core boxes are usually memory
uptimeSee how long the box has been up and the average load — is it slow or just you?
Network Diagnosis5 commands
curl -I https://example.comFetch only HTTP response headers — is the site up, is the status code right?
ping -c 4 8.8.8.8Test network connectivity; -c 4 sends just 4 packets then stops
ss -tlnpShow which ports are listening — see at a glance whether the service really started
curl ifconfig.meLook up this machine's public IP — needed when setting DNS
dig example.com +shortCheck which IP a domain resolves to — has the DNS change taken effect?
Compress & Extract4 commands
tar -czvf backup.tar.gz /var/wwwPack and compress the site directory — one-liner backup
tar -xzvf backup.tar.gzUnpack the backup above — use it when restoring
zip -r site.zip .Make a zip archive — handy for sharing or downloading locally
unzip site.zip -d /tmp/restoreExtract a zip into a target directory without polluting the current one
Package Management5 commands
apt update && apt upgrade -yUpdate package lists and upgrade on Ubuntu — first thing on a fresh server
apt install -y curl git htopInstall everyday tools; -y skips the install confirmation
node -v && npm -vConfirm node is installed and the version is the one you expect
which nodeFind where node is actually installed — check this first when versions get confusing
timedatectl set-timezone Asia/ShanghaiSet the timezone to Shanghai so log timestamps make sense
Log Troubleshooting5 commands
systemctl status nginxWhen a service dies, look here first: active or failed?
journalctl -u nginx --no-pager -n 50Last 50 lines of nginx logs — hunt the error message
journalctl -f -u myappFollow one service's logs live; Ctrl+C to quit
tail -n 100 -f /var/log/nginx/error.logLive nginx error log — check here first for 502s
dmesg | tail -n 30Kernel log — find evidence here when the system kills processes (OOM)
Terminal animation demos
We picked the 7 commands most worth watching. Scroll to them and they auto-play: first how the command is typed, then what the output looks like, and finally a "watch here" note telling you which column to look at. Then grab the command above and use it.
ls -lah: file details
👀 Note:The first column is permissions (lines starting with d are directories); the fifth is file size. -h shows human-readable K, M units. Notice id_ed25519 is -rw------- — readable only by you, which is exactly how an SSH key should be.
df -h: disk space
👀 Note:Watch the Use% column. Over 80% means clean up logs and caches; at 100% the site returns 500 — run df -h before touching anything.
ps aux | grep node: find a process
👀 Note:The second column, 812, is the process ID — kill 812 if the service is stuck. The last line is the grep command itself; ignore it.
tail -f: follow logs live
👀 Note:-f keeps waiting and scrolls as new logs arrive — that scrolling is simulated above. When tracking down a problem, keep a window tailing the log; Ctrl+C to quit.
curl -I: is the site up?
👀 Note:Only the first line matters — 200 means it's up; 301/302 are redirects; 404 means no such page; 502 usually means the backend service didn't start.
chmod 600: fix SSH key permissions
👀 Note:chmod succeeds silently — no news is good news. Now verify:
👀 Note:Permissions are now -rw------- — readable only by you, which is what SSH requires. If it's -rw-r--r--, login will be rejected.
systemctl status: is the service alive?
👀 Note:Just read the Active line — active (running) means alive, failed means dead. If it's dead, don't restart right away; scroll down into the logs to find out why it died.
Want to learn properly? The blog has matching hands-on guides: "10 things to do first on a new VPS", "Caddy reverse proxy: add HTTPS to your site in 5 minutes", "systemd daemons: restart the service automatically when it dies" — visit the blog →