Suggested day 1420–30 minutesCaution

Mission 4 of 5

Process Management

Identify and stop only a practice process you started.

View processes, start harmless background jobs, and stop only the jobs you created.

Outcome: You can stop a runaway practice command without panicking.

Mental model

Understand what is happening

A process is a running program.

PID means process ID.

Kill only processes you understand.

Guided lab

Work through the mission

1

View processes

Read-only

Shows current and system processes.

Terminal
ps
ps aux | head -15
pgrep -l bash
2

Create and stop a practice job

Caution

Starts one harmless background process, captures its exact PID with $!, then stops and waits for that same process. This remains deterministic even when other jobs already exist.

Terminal
cd ~/linux-practice
sleep 100 &
practice_pid=$!
echo "Started practice PID: $practice_pid"
jobs -l
kill "$practice_pid"
wait "$practice_pid" 2>/dev/null || true
jobs -l
3

Broad process killing examples

Caution

Useful but broad. Prefer job number or exact PID while learning.

Terminal
killall sleep
pkill -f 'sleep 200'

Checkpoint

Verify the mission

The practice process disappears while unrelated processes remain.

Try it yourself

One step without a recipe

Start one sleep job, list it, stop it, and confirm it is gone.

Need a hint?

When something hangs, don't reach for `kill -9` first. Try plain `kill` — it sends a polite 'please stop' signal (SIGTERM). Most well-written programs will shut down cleanly. `kill -9` is the sledgehammer. It works, but it skips cleanup and can leave temp files or locked resources behind. Save it for when polite doesn't work.

Explain it back

Before you move on

  • What is a PID?
  • Why should you avoid broad pkill patterns as a beginner?

Shortcuts:Alt + ← previous lessonAlt + → next lessonAlt + H home? focus search