kill Command Guide for Sending Signals to Processes
This guide helps you understand and use the kill command, the standard way to stop, pause, or otherwise signal a running process.
What is kill, and Why Use It?
The kill command sends a signal to a process — most often the request to terminate it. Its name is historical: it can do much more than kill. It can ask a process to reload its config, pause it, resume it, or tell it to reread a file. Every signal is a small message, and kill is how you deliver one, using the process ID (PID) as the address.
Why Learn kill?
- The only way to stop a stuck program: When an app will not quit,
killis the last resort. - Signals are the OS’s remote control: Reload a web server without dropping connections, pause a job, resume it — all signals.
- It is the foundation of job control:
jobs,bg, andfgare built on the same idea. - Universal:
killworks the same on every Unix-like system.
killdoes not mean “destroy” — it means “send a message.” SIGTERM says “please stop”; SIGKILL says “you are being removed.”
1. Kill a Process by PID
ps aux | grep nginx # find the PID
kill 1234 # politely ask PID 1234 to terminate
killneeds the process ID, whichpsorpgrepprovide;- Without a signal,
killsends SIGTERM (15) — the polite request to shut down cleanly; - A well-behaved process saves state and exits; a well-written service shuts down gracefully.
2. Force-Kill with SIGKILL
kill -9 1234
-9sends SIGKILL — the forceful kill the kernel enforces immediately;- The process cannot ignore, block, or clean up after SIGKILL;
- Use it only when SIGTERM fails — a process killed with -9 leaves temporary files and half-finished work behind;
- The modern equivalent is
kill -KILL 1234, which reads the same but is harder to mistype.
3. List Available Signals
kill -l
-lprints every signal the system knows, by number and name;- The important ones:
SIGTERM (15)polite stop,SIGKILL (9)immediate stop,SIGHUP (1)reload config,SIGINT (2)interrupt (like Ctrl+C),SIGSTOP (19)pause,SIGCONT (18)resume; - Signal names can be used with or without the
SIGprefix:-TERM,-SIGTERM, and-15all mean the same thing.
4. Reload a Configuration with SIGHUP
kill -HUP 1234
# or
kill -1 1234
- Many daemons — web servers, log rotators — treat SIGHUP as “reread your config and keep running”;
- This is how you apply a config change without dropping active connections;
- Not every program honors SIGHUP this way — check its documentation.
5. Pause and Resume with STOP and CONT
kill -STOP 1234 # freeze the process in place
kill -CONT 1234 # resume it exactly where it stopped
- SIGSTOP suspends a process without killing it — useful for debugging or buying time;
- A stopped process keeps its memory and open files but uses no CPU;
- SIGCONT resumes it;
bgandfguse these signals behind the scenes for shell jobs.
6. Kill Several Processes at Once
kill 1234 5678 9012
# or, with a range:
kill 100-110
killaccepts multiple PIDs in one command;- A dash creates a range of consecutive PIDs;
- Combine with
pgrep:kill $(pgrep -f firefox)stops every matching process.
Common Pitfalls
- Reaching for -9 first: SIGKILL skips all cleanup. Try plain
kill(SIGTERM) and give the process a moment; escalate to -9 only if it refuses. - Killing the wrong PID: Double-check with
ps -p 1234before killing — a recycled PID belongs to a different program now. - Expecting kill to work on zombies: A zombie (
Zstate intop) is already dead; its parent must reap it.killcannot help — fix the parent instead. - Forgetting PID 1:
kill 1targets the init system; on most systems it is ignored, but do not experiment on production machines.
Related Pages
| Page | Description |
|---|---|
ps | Find the PIDs kill needs |
pgrep | Look up PIDs by name |
killall | Kill by program name instead of PID |
pkill | Kill by name pattern with filters |
jobs | Shell jobs kill can also target |
nohup | Keep processes alive after logout |
kill Cheatsheet
| Task | Command |
|---|---|
| Politely stop a process | kill 1234 |
| Force-kill | kill -9 1234 or kill -KILL 1234 |
| List signals | kill -l |
| Reload config | kill -HUP 1234 |
| Pause / resume | kill -STOP 1234 / kill -CONT 1234 |
| Kill several | kill 1234 5678 or kill 100-110 |
| Kill by name pattern | kill $(pgrep -f name) |