The CLI is where truth lives. GUIs lie by omission. This module is about moving around, reading safely, and respecting wildcards.
Bootcamp hub · Prev: Module 1
Learning goals
- Navigate with
cd,ls,pwd, tab-complete - Read with
less,head,tail -f,grep - Use pipes without cargo-culting
- Fear (correctly)
rm, globs, and unquoted variables
Habits that keep jobs
- Prefer
lessover opening huge logs in editors - Expand globs mentally before Enter — see Linux special characters
- Use
--end-of-options when paths can start with- - Never practice destructive commands on production
Required reading: The Linux commands that can wipe a server.
Lab
- Create a playground directory in your home; only destroy things inside it.
- Practice
findwith-nameon that playground. - Follow a log with
tail -fwhile generating messages. - Write a one-liner pipeline and explain each stage out loud.
Next: Module 3 — Users & SSH →
Essential command groups
Orientation: pwd, ls -la, cd, tree (if installed).
Reading: less, head, tail, grep -R, rg if available.
Identity: whoami, id, sudo -l.
Disk peek: df -h, du -sh * (in safe directories).
Pipelines and redirection
grep -i error /var/log/syslog | tail -n 20
command > out.txt 2> err.txt
command >> append.log 2>&1
Know the difference between overwrite (>) and append (>>). Overwriting production logs by accident is a classic bad day.
Quoting in one paragraph
Double quotes allow expansion; single quotes don’t; unquoted globs expand. When in doubt, put complex strings in single quotes or better — a script file. Details: special characters guide.
Safety lab (mandatory)
- In a playground directory only, create files
a.txt,b.txt. - Experiment with quoted and unquoted
*. - Read the cautionary post on dangerous commands and write three personal rules in your notes.
Stretch goals
- Learn
tmuxorscreenfor long sessions - Use
historyand timestamped history - Practice
manpages without panicking
Copy-paste hygiene
Blogs (including this one) sometimes render fancy dashes. Prefer typing critical commands. When pasting, paste into a editor first. Watch for Windows CRLF in shell scripts (^M errors).
Own your history
export HISTTIMEFORMAT="%F %T "
export HISTCONTROL=ignoredups
Timestamped history turns “what did I run?” into an answerable question during postmortems.
Mini project
Write a 15-line script that prints disk use for $HOME and exits non-zero if over a threshold. Run it manually. You’ll reuse the idea in Module 6 with cron.
Extended lab: log archaeology
Generate noise: run commands that fail on purpose. Find those failures with grep/journalctl. Save a pipeline that finds the last ten errors. Put it in your notes. Avoid destructive cleanups — Module 4 covers disks.
Re-read dangerous commands and add one personal rule that you didn’t have yesterday.
Reading man pages without despair
Start with SYNOPSIS and EXAMPLES. Skim OPTIONS only when needed. Use man man once so the sections make sense. For quick help, command --help is fine — but man pages explain behavior under edge cases that –help skips.
Filesystem navigation drills
- From
/, navigate to your home without using~once. - Create nested directories with
mkdir -p. - Use
pushd/popdif available. - Find a config in
/etcrelated to SSH and open it read-only withless.
Speed comes from repetition, not from downloading someone else’s aliases on day one.
Shell exit codes and pipelines
Every command returns an exit code. Zero usually means success. Pipelines and set -e change how failures propagate. Practice:
false; echo $?
true; echo $?
ls /nope || echo "handled missing path"
In scripts you’ll write later, ignoring exit codes is how cron “succeeds” while backups are empty.
Editors under pressure
Know enough nano or vim to edit a config and exit. Panic-Googling “how to quit vim” during an outage is a rite of passage — better to practice now. Save, quit, reopen, confirm.
Transferring files safely
Use scp or rsync -avP for lab files. Prefer checksums for important artifacts. Don’t exfiltrate production data into personal chat apps.
