Lesson 14 / 31

Killing Processes

Stop processes with kill, killall and pkill, and know when kill -9 is a last resort.

kill by PID

kill PID sends a termination signal, asking the process to shut down gracefully.

ps aux | grep nginx
kill 842

kill -9 — force it

kill -9 PID (SIGKILL) forcibly terminates a stuck process with no cleanup — use it only when a plain kill doesn't work.

kill -9 842

killall & pkill

killall nginx kills every process named nginx. pkill -f pattern matches against the full command line.