Phase 1 · FOUNDATIONS
Week 1 review + Server Down!
By the end of today
- Consolidate week 1 into one orient, investigate, fix, verify loop
- Diagnose and fix a downed server under 2 a.m. pressure
- Walk a 2 a.m. incident calmly in an interview
The Week-1 muscle: orient → investigate → fix → verify
Six days in, you have a pile of commands: whoami, pwd, ls, cd, cat, chmod, ps, kill. Today is not a seventh pile. It’s the day those commands stop being trivia and become a reflex — the exact reflex an on-call engineer runs when a server falls over.
Every incident, from a hobby VPS to a bank’s payment tier, follows the same four beats:
Orient. Where am I, who am I, what’s here? Day 1’s whoami and pwd, Day 2’s map of the filesystem, and Day 3’s ls/cd answer this in seconds. You never act on a box you can’t describe.
Investigate. What is actually wrong? Day 4 taught you to read — cat a log, then grep it for the one line that matters. Day 5’s permissions explain a whole class of failures (“it can’t write because it doesn’t own the file”). Day 6’s ps and top show what is really running versus what you assume is running.
Fix. Change exactly one thing. Day 6’s kill stops a runaway process; Day 5’s chmod/chown repairs access; an edit fixes a config. One change, chosen because the investigation pointed at it — not because you are guessing.
Verify. Did it actually recover? Re-run the same ps, re-read the same log, hit the health check. An incident isn’t over when you did something; it’s over when the evidence says the service is healthy again.
Real world: It’s 2 a.m. and your phone is screaming that checkout is down. You will not be calm, and you will not remember anything clever. What saves you is boring muscle memory: get your bearings, read the log, list the processes, stop the one that’s on fire, and watch the graph come back. The engineers who look unflappable in a crisis aren’t smarter — they just run this loop without thinking.
A named example makes it concrete. Google’s Site Reliability Engineering teams turned this into a formal discipline. Their incident-response practice has an on-call engineer assess the situation (orient), diagnose the cause (investigate), and mitigate it (fix) — and only close the incident after confirming the service recovered, with a blameless postmortem afterward so the loop teaches the whole team, not just whoever was awake. The commands you learned this week are the ground floor of exactly that job.
That is why Day 7 is a mission, not a lecture. Reading about incidents doesn’t build the reflex — running one does. The Server Down! lab below drops you onto a (simulated) 2 a.m. page and makes you walk all four beats with the commands from days 1–6. No new syntax. Just proof that the muscle works under pressure.
Hands-On Lab
Today the lab is the mission. No WSL2, no setup, nothing to paste — Server Down! runs entirely in your browser.
This is your Week-1 boss fight. It’s 2 a.m., PagerDuty just went off, and checkout is down on prod-web-01. You are the only one awake, and every minute costs money. Everything you need is something you already learned in days 1–6, so play it as the four beats:
- Orient with
pwd,ls, andcd— get your bearings and notice who owns what on an unfamiliar box (days 1–3, and the permissions instinct from day 5). - Investigate by
cat-ing andgrep-ing the server log for the line that names the offending process (day 4). - Confirm the culprit with
ps— cross-check what the log claims against what’s actually running and pegging the CPU (day 6). - Fix and verify by sending the runaway process a
killsignal, then re-checkingpsand the log until checkout reads healthy again (day 6).
Type help in the terminal to see the supported commands, and hint if you stall — it nudges without solving. There is no penalty for poking around; the whole point is to run the orient → investigate → fix → verify loop with your hands, under a little (fake) pressure, until it’s reflex. Bring checkout back — then, if you want the bragging rights, replay it and try to finish in fewer commands.
When the recovery rolls in, come back and note below what tripped you up — that reflection is where the lesson sticks.
Common Errors & Fixes
These are the mistakes that trip people up when they run the incident loop for real in WSL2 Ubuntu 24.04 — the same beats the mission rehearses (orient, fix, verify). Read the error text slowly; parsing it is the skill.
Common error: Fixing before orienting — you go to read the log, but you point
grepat a path that doesn’t exist on this box:grep: /var/log/app.log: No such file or directoryWhy: The log lives somewhere else — a different app, a different distro layout, or a service-specific directory like
/var/log/nginx/.grepcannot search a file that is not there, so it reports the path it could not open and exits non-zero.Fix: List the directory first:
ls /var/log(thenls /var/log/<service>/) to find the real filename, and grep that. This is the “orient” beat — confirm what is actually on the box before you investigate it.How you’d spot it in prod: A CI step or a health script that greps a hard-coded log path fails the moment a service relocates its logs. The failing line names the missing path — fix the path in the script, don’t assume the log vanished.
Common error: Killing a process you don’t own — you spot the offender in
ps, but it runs as another user (or as root), so yourkillbounces:bash: kill: (1) - Operation not permittedWhy: Linux only lets you signal processes you own. A normal user cannot kill root’s processes (or another user’s) without elevated privileges — the same ownership rule from day 5, now applied to processes instead of files.
Fix: Read the owner in the first column of
ps aux, decide the stop is safe, then escalate deliberately withsudo kill <pid>. In a real incident you confirm you’re allowed to stop that service before you do.How you’d spot it in prod: A restart script that runs as an unprivileged user silently fails to stop a root-owned daemon.
Operation not permittedin its logs means the service account lacks rights — fix the ownership or the sudo rule, don’t loosen everything.
Common error: Skipping verify — you send
kill 4821to stop the runaway process, then reflexively fire it again “to be sure,” but it’s already gone:bash: kill: (4821) - No such processWhy: The first
killworked; there is no longer a process with that PID, so the second signal has nothing to hit. The shell’skillbuiltin reports the PID it could not find.Fix: Don’t re-send the signal — verify instead. Re-run
ps -p 4821(it prints just the header row with no process line, and exits non-zero) orps aux | grep <name>(no matching line) — either is your proof the process is gone. That’s the “verify” beat: you confirm recovery with fresh evidence, not by firing the fix twice.How you’d spot it in prod:
No such processin a shutdown script usually means the process already exited (or you captured a stale PID from a pidfile). Re-check that the service — not just one PID — is actually down before you treat it as an error.
Incident Response Interview Questions
These four are pure interview ammo — an incident walk-through is the most common Phase-1 screening question, and “tell me about a time a server was on fire” rewards a calm, specific answer over a clever one. Cover each answer, say your own version out loud first, then compare — recalling before revealing is what makes it stick for interview day.
Go Deeper
Optional extras if you have ~30 more minutes:
- 5 min — Replay Server Down! and try to finish in the optimal 7 commands for a cleaner rank — speed here is just knowing the loop cold.
- 10 min — Run
man psand skim theauxand--sortflags; being able to rank processes by CPU or memory on demand is a daily reflex. - 15 min — Reread the Linux for DevOps guide end to end now that the commands mean something — the second pass is where it consolidates.
Walk me through diagnosing a server pegged at 94% CPU. Both
First I orient — I confirm which host and which service is actually affected before touching anything. Then I find the load: top, or ps aux --sort=-%cpu, ranks processes by CPU so the worst offender sits at the top, and I note its PID, user, and command. Before I kill anything I read that process's logs to understand what it's doing — a nightly backup starving the app is a very different story from a real traffic spike. Once I'm sure it's the culprit and safe to stop, I kill it and watch CPU drop and the app recover. The habit that matters: identify with evidence before you act, then verify recovery instead of assuming the kill worked.
How do you find what's eating CPU, then stop it? Product
ps aux --sort=-%cpu | head, or top, ranks processes by CPU so the worst offender is at the top — I read off its PID. To stop it I send a signal with kill <pid>, which defaults to SIGTERM: a polite 'please shut down' the process can catch to clean up first. If it ignores that and keeps burning CPU, kill -9 <pid> sends SIGKILL, which the kernel enforces with no chance to clean up. Then I re-run ps to confirm it's actually gone and check that the real service reclaimed the CPU. The point isn't just killing something — it's killing the right PID and confirming the box is healthy afterward.
What's the difference between SIGTERM and SIGKILL in an incident? Both
SIGTERM — a plain kill <pid> — is the graceful signal: it asks the process to shut down, and a well-behaved process catches it to finish in-flight work, flush buffers, and close files cleanly. SIGKILL — kill -9 — can't be caught or ignored; the kernel terminates the process immediately, which risks corrupt state or half-written files. In an incident I reach for SIGTERM first so the process exits cleanly, and only escalate to SIGKILL if it's truly stuck and the bleeding is worse than the risk. Reflexively kill -9-ing everything is a rookie tell — it can leave a database or file half-written and turn one incident into two.
How do you confirm a service actually recovered? Both
I don't trust the fix — I trust the evidence. After the change I re-run the exact check that showed the problem: ps to confirm the app process is back and stable, the log to confirm errors stopped and healthy lines resumed, and the health endpoint or a real request to confirm it's serving traffic. I watch for a minute rather than one green blink, because a crash-looping service can flash healthy between restarts. Only when the same signals that screamed 'down' now read 'up' do I call it resolved — and then I write down what happened while it's fresh, so the postmortem isn't fiction.
Mark Day 7 complete
Tomorrow you stop reading logs by eye — grep, sed and awk turn a wall of text into answers.
Mission unlocked: Server Down! — you have the skills now.
Play (15–20 min)Stuck on today’s lab? Ask in Mission 90 Q&A