Mission 14 of 30
Process Management
Identify and stop only a practice process you started.
View processes, start harmless background jobs, and stop only the jobs you created.
Practice inside
~/linux-practice. Check your setup before you begin.
Prerequisite: Ownership and Groups Without Fear
.
What you’ll practice
- Use ps and pgrep
- Manage jobs
- Send termination signals carefully
The mental model
- A process is a running program.
- PID means process ID.
- Kill only processes you understand.
Try it in your terminal
View processes
Read-only system viewShows current and system processes.
Run from ~/linux-practice
ps
ps aux | head -15
pgrep -l bash Create and stop a practice job
CautionStarts 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.
Run from ~/linux-practice
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 Broad process killing examples
CautionUseful but broad. Prefer job number or exact PID while learning.
Run from ~/linux-practice
killall sleep
pkill -f 'sleep 200' Put it into practice
- Start one sleep job, list it, stop it, and confirm it is gone.
Check your result
The practice process disappears while unrelated processes remain.
Common mistakes
- You see a process hanging and immediately type `kill -9 1234`. That's the nuclear option. It works, but it doesn't give the program a chance to clean up. Try `kill 1234` first — that sends SIGTERM, a polite request to stop. Most programs respond. If they don't after ten seconds, then reach for -9.
- You run `pkill -f 'python'` to stop one script and accidentally kill every matching Python process you have permission to signal. Broad kill patterns are dangerous. Capture the process ID with `$!` when starting a background job, then signal that exact PID.
Check your understanding
Explain these in your own words. If you’re unsure, revisit the examples before moving on.
- What is a PID?
- Why should you avoid broad pkill patterns as a beginner?
Your practice, your pace
Loading saved progress…