Stopping Processes: kill
Sometimes a process misbehaves: it freezes, consumes all the CPU, or simply needs
to be stopped. The kill command sends a signal to a process, asking (or
forcing) it to terminate.
The basic usage is: kill PID.
kill 510
This sends signal 15 (SIGTERM), a polite "please shut down." Most well-behaved programs will clean up and exit.
Forcing a stubborn process
If a process ignores SIGTERM, send signal 9 (SIGKILL), an immediate, unconditional termination:
kill -9 510
The process gets no chance to clean up; the kernel destroys it instantly. Use -9
only when the polite signal fails.
Background jobs with &
You can start a process in the background by appending &:
sleep 300 &
[1] 1312
The shell gives you its PID (1312) so you can kill it later if needed.
Mission: Terminate the Frozen Nav-Computer
The navigation computer locked up mid-calculation and no longer answers a polite request to stop. The pilot needs it gone, and only it: the reactor monitor and life support keep running. Find its process and stop it by force, then file a fresh list of the processes still running as incident-log/after-kill.txt.
Expected result
The navigation computer is no longer running, the other station programs are, and incident-log/after-kill.txt is a process list without it.