Glossary#
| Term | Plain meaning | Chapter |
|---|---|---|
| terminal / shell | the text window / the program interpreting commands (bash, zsh) | 1 |
| prompt | the text before the cursor; $ normal user, # root | 1 |
| option / flag / argument | changes behaviour (-l) / what to act on | 1 |
| man page | a command's built-in manual | 1 |
| working directory | the folder you're in now | 2 |
home directory (~) | your personal folder | 2 |
| hidden file | a name starting with . | 2 |
/etc, /var/log, /proc | config / logs / live kernel info | 2 |
| symbolic link | a small file pointing to another path | 3 |
| owner / group / others | the three permission classes | 4 |
| r / w / x | read / write / execute (enter, for directories) | 4 |
| 755 / 644 / 600 | scripts & dirs / normal files / secrets | 4 |
| root / sudo | the superuser / run one command as root | 4 |
| umask | the mask giving new files their default permissions | 4 |
redirection (>, >>, 2>&1) | sending streams to files | 5 |
pipe (|) | one command's output into the next command's input | 5 |
/dev/null | discards everything written to it | 5 |
&& / || | run next only on success / only on failure | 5 |
| regular expression (regex) | a pattern language for text | 6 |
| grep / sort / uniq / cut / awk / sed / find / xargs / jq | filter / order / count / columns / column scripts / replace / search files / build arguments / JSON | 6 |
| load average | runnable + waiting processes over 1/5/15 minutes | 7 |
background job (&) / nohup / tmux | runs without holding the prompt / survives logout / persistent terminal | 7 |
| environment variable | named setting every process inherits a copy of | 8 |
| PATH | folders searched, in order, for a command | 8 |
.zshrc / .bashrc | shell startup files | 8 |
.env file | local file of configuration variables (never commit it) | 8 |
| shell script / shebang | a file of commands / its first line saying which interpreter runs it | 9 |
set -euo pipefail | stop on errors, unset variables and pipeline failures | 9 |
| SSH | encrypted remote terminal, port 22 | 10 |
| authorized_keys / known_hosts | public keys allowed in / servers you've trusted | 10 |
| scp / rsync | copy files / sync only changes | 10 |
SSH tunnel (-L) | forward a local port through a server | 10 |
| bastion / jump host | the single secure entry server into a private network | 10 |
| package manager | apt / dnf / brew / apk — installs software | 11 |
| systemd / service / daemon / unit file | Linux service manager / long-running program / its definition | 11 |
| journalctl | reads systemd's logs | 11 |
| cron / crontab | time-based job scheduler / its schedule | 11 |
| postmortem | a write-up of an incident and how to prevent it | 12 |
Cheat Sheet#
Moving and looking
pwd · ls -lah · cd dir · cd .. · cd ~ · cd - Tab to complete · Ctrl+R to search historyFiles
less f · head -n 20 f · tail -f f · wc -l f
mkdir -p a/b · cp -r src dst · mv old new · rm -r dir (ls it first!) · ln -s target linkPermissions
r=4 w=2 x=1 · 755 scripts/dirs · 644 files · 600 secrets · chmod +x script.sh · chown user:group fStreams
> overwrite · >> append · 2> errors · > f 2>&1 both · | pipe · > /dev/null discard · && on success · || on failureText recipes
top values of column N: awk '{print $N}' f | sort | uniq -c | sort -rn | head
search recursively: grep -rn "text" .
context around matches: grep -C 3 "Traceback" app.log
big old files: find /var/log -name "*.log" -size +100M -mtime +7
JSON field: curl -s URL | jq '.field'Processes, services, schedules
ps aux | grep x · pgrep -fl x · top · kill PID · kill -9 PID (last resort) · cmd & · nohup cmd &
systemctl status|restart|enable svc · journalctl -u svc -f · crontab -e (m h dom mon dow)Incident checklist
systemctl status → journalctl → df -h → du -sh → free -h / dmesg → uptime / top
→ ss -tlnp / lsof -i :PORT → curl localhost/health → nc -vz dependency → digTry This Yourself#
Build the log pipeline. Create
access.logfrom Chapter 6 (copy the 8 lines into a file with a text editor, or withcat > access.log, paste, then Ctrl+D). Run the top-IPs pipeline one stage at a time — add one| commandat a time and look at the output after each — until you can predict every stage's output before pressing Enter.Permission drill.
touch secret.txt, thenls -l secret.txt(note 644). Runchmod 600 secret.txtand check again. Make a script:echo 'echo hello' > hi.sh, try./hi.sh(permission denied), thenchmod +x hi.shand run it.Write a script. Write
check.shthat usesset -euo pipefail, runsdf -h /, and printsDISK WARNINGto stderr and exits with code 1 if usage is above 80%. Hint:df -P / | awk 'NR==2 {print $5}' | tr -d '%'prints just the number. Test the failure branch by temporarily changing 80 to 1.