Welcome to your 20-minute Linux shell mini-challenge!
Learn to:
- Launch background jobs (fake zombie-like processes)
- Identify and monitor running processes
- Kill them using
kill
,killall
, orpkill
- Observe real CPU/MEM changes via
top
-
Give executable permission to both scripts:
chmod +x spawn_zombies.sh monitor_top.sh
-
Run the zombie spawner:
./spawn_zombies.sh
-
Open a new terminal tab and monitor system resources:
top
-
After attempting cleanup, run the monitor to compare system load:
./monitor_top.sh
-
Locate processes using:
ps aux | grep sleep top htop
-
Kill them using:
kill <PID> killall yes pkill tail
-
Observe the drop in CPU/memory usage in
top
- Can you
killall
all dummy jobs in one command? - Whatβs the PID of the infinite
while
loop? - Which process consumed the most CPU?
- What happens if you donβt
&
(background) a job?
Command | Description |
---|---|
jobs -l |
Show running background jobs |
ps aux |
List all system processes |
kill <PID> |
Kill a process by PID |
killall <name> |
Kill all processes by name |
top / htop |
Monitor system resource usage live |
pkill <name> |
Kill process by name using pattern |
This challenge simulates how we handle rogue or resource-hogging processes in production. You'll use these skills often when:
- Restarting broken services
- Automating cleanup tasks
- Managing cron jobs and daemons
- Debugging memory leaks and CPU spikes
β¨ Bonus Tip: Always be cautious with
kill -9
. It's like the nuclear option. π§¨
Happy hunting! Letβs terminate those zombies! π§ββοΈπ»