The kill command sends a signal to one or more process IDs (PIDs).
Despite the name, it is not only for terminating processes. It can also request reloads, interrupt jobs, or trigger custom signal handlers.
Overview
Common signal usage:
SIGTERM(15): graceful stop request (default)SIGKILL(9): immediate forced terminationSIGHUP(1): often used to reload configurationSIGINT(2): interrupt signal (like Ctrl+C)
Syntax
kill [options] pid...
Command Quick Reference
| Command | Purpose |
|---|---|
kill <pid> |
Send default signal (TERM) |
kill -TERM <pid> |
Graceful terminate |
kill -KILL <pid> |
Force terminate |
kill -HUP <pid> |
Request reload behavior |
kill -l |
List available signals |
Core Workflows
Graceful Termination (Preferred)
kill 12345
kill -TERM 12345
Force Termination (Last Resort)
kill -KILL 12345
Use only when the process does not respond to TERM.
Signal Multiple Processes
kill -TERM 1234 5678 9012
View Signal Names
kill -l
Useful Options
| Option | Meaning |
|---|---|
-s <signal> |
Specify signal by name |
-SIGNAL |
Specify signal by shorthand |
-l |
List signal names |
Examples
kill -TERM 12345
kill -HUP 2211
kill -KILL 4242
Troubleshooting
Operation Not Permitted
You can only signal processes you own unless using elevated privileges.
sudo kill -TERM <pid>
No Such Process
The PID may have exited already or changed. Re-check with:
ps -fp <pid>
Best Practices
- Try
TERMbeforeKILL. - Confirm target PID carefully to avoid affecting the wrong process.
- Use
pgrepto locate PIDs reliably by name. - Prefer service managers (
systemctl) for managed services.
Related Commands
ps: Inspect processes by PIDpgrep: Find matching PIDspkill: Signal by process patternsystemctl: Control systemd-managed services