kill – send signals to processes

kill sends signals to processes, most commonly to terminate them. Despite the name, it can send any signal.
Synopsis
kill [OPTIONS] PID...
kill -SIGNAL PID...
Common Signals
| Signal | Number | Description |
|---|---|---|
| TERM | 15 | Graceful termination (default) |
| KILL | 9 | Force kill (cannot be caught) |
| HUP | 1 | Hangup / reload config |
| INT | 2 | Interrupt (like Ctrl+C) |
| STOP | 19 | Pause process |
| CONT | 18 | Resume paused process |
Examples
Terminate process gracefully
$ kill 1234
$ kill -15 1234
$ kill -TERM 1234
Force kill (when TERM doesn’t work)
$ kill -9 1234
$ kill -KILL 1234
Reload configuration
$ kill -HUP $(pgrep nginx)
$ sudo kill -HUP 1 # Reload init
Kill by name
$ pkill firefox
$ killall firefox
Kill all processes of a user
$ pkill -u username
List available signals
$ kill -l
1) SIGHUP 2) SIGINT 3) SIGQUIT 4) SIGILL
5) SIGTRAP 6) SIGABRT 7) SIGBUS 8) SIGFPE
9) SIGKILL 10) SIGUSR1 11) SIGSEGV 12) SIGUSR2
...
Pause and resume
$ kill -STOP 1234 # Pause
$ kill -CONT 1234 # Resume
Kill vs Kill -9
Always try graceful termination first:
# Step 1: Ask nicely
$ kill 1234
# Step 2: Wait a few seconds
$ sleep 5
# Step 3: Force if still running
$ kill -9 1234
Why? SIGTERM allows processes to:
- Save data
- Clean up temp files
- Close connections properly
SIGKILL (-9) terminates immediately without cleanup.
Common Patterns
Kill process on port
$ kill $(lsof -t -i:8080)
$ fuser -k 8080/tcp # Alternative
Kill all matching processes
$ pkill -f "python script.py"
Kill process tree
$ pkill -P 1234 # Kill children of PID 1234
Tips
- Try TERM first: Always give processes a chance to clean up
- Check before killing:
ps -p PIDto verify it’s the right process - Use pkill/killall: Easier than finding PIDs manually
- Zombie processes: Can’t be killed (parent must handle)
- Permission: Need to own process or be root
See Also
Related Commands
- ps — Find process IDs
- pkill — Kill by name
- killall — Kill all matching processes
- top — Interactive process killer






