kill sends a Unix signal to a process by PID. The name is misleading: kill does not always kill; by default it sends SIGTERM (15), which politely asks a process to exit. For processes that ignore termination, SIGKILL (9) cannot be caught and is the nuclear option.
kill 1234 # SIGTERM — the polite default
kill -9 1234 # SIGKILL — cannot be caught
kill -HUP 1234 # SIGHUP — often "reload config"
kill -l # list all signal names and numbers
kill -STOP 1234 # pause the process
kill -CONT 1234 # resume a paused process
killall kills by name instead of PID: killall firefox. pkill adds pattern matching: pkill -f 'python.*analyze'. Always try SIGTERM first; many programs rely on it to flush buffers, close files, and clean up.
Discussed in:
- Chapter 10: Processes and Job Control — Signals and Killing Processes