Killing Processes
kill — Send signal to process
kill PID # Send SIGTERM (graceful stop)
kill -9 PID # Send SIGKILL (force kill)
kill -SIGTERM PID # Same as kill PID
kill -l # List all signals
Common signals
| Signal | Number | Meaning |
|---|---|---|
| SIGTERM | 15 | Graceful shutdown (default) |
| SIGKILL | 9 | Force kill (can't be caught) |
| SIGHUP | 1 | Reload config (for daemons) |
| SIGSTOP | 19 | Pause process |
| SIGCONT | 18 | Resume process |
killall and pkill
killall nginx # Kill all processes named exactly nginx
pkill -u student # Kill all processes by user student
pkill -f "sleep 300" # Match anywhere in the full command line
Best practice
Always try SIGTERM first:
kill PID # Try graceful shutdown first
sleep 5
kill -9 PID # Force kill if still running
Keyboard shortcuts
Ctrl+C— Send SIGINT to foreground processCtrl+Z— Send SIGSTOP (pause)Ctrl+\— Send SIGQUIT