killall Command Guide for Killing by Name
This guide helps you understand and use the killall command, which stops every process running a given program name — no PID hunting required.
What is killall, and Why Use It?
The killall command sends a signal to all processes matching a name. Instead of finding each process ID with ps and passing them one by one to kill, you say the program’s name and killall finds and signals every instance. It is the shortest path from “stop nginx” to “nginx stopped” when the program name is exact and unique.
Why Learn killall?
- Speed: One command instead of find-then-kill for programs with many instances.
- Safety of name matching: It matches the exact executable name, not a substring of the whole command line.
- Signals work too:
killall -HUPreloads a daemon’s config the same waykill -HUPdoes.
killalliskillwith the addressing built in: you name the target, and it finds every instance.
1. Kill All Instances of a Program
killall firefox
- Every process named exactly
firefoxreceives SIGTERM (15); - The command prints nothing on success — silence means every target was signalled;
- Verify with
psorpgrepthat nothing remains.
2. Choose a Specific Signal
killall -9 firefox # force-kill
killall -HUP nginx # ask nginx to reload its config
-9sends SIGKILL when a program refuses to exit;-HUP(SIGHUP) asks daemons to reread their configuration;- The signal rules are the same as in
kill—killall -llists them.
3. Match Only Running-or-Exact Names
killall -e firefox # require an exact name match
killall -i firefox # ask for confirmation before killing
-emakes matching strict — useful when a longer name could accidentally match;-iprompts before each kill, a guard against typos;-v(verbose) prints each process it signals, useful for confirming what happened.
4. Wait for Processes to Finish
killall -w firefox
-wwaits until all signalled processes have actually exited;- Useful in scripts that must be sure the old instance is gone before starting a new one;
- Combine with a timeout wrapper if the process might hang.
Common Pitfalls
- Expecting pattern matching:
killallmatches the whole executable name, not substrings.killall pythwill not findpython3— that ispkill’s job. - Killing by the wrong name: Check the exact name with
pgrep -l firefoxfirst;killallon a wrong name silently does nothing. - Assuming it kills children:
killallsignals the processes you name, not their children — a killed parent may leave orphaned workers behind. - Reaching for -9 by reflex: Give SIGTERM a chance first; see
killfor when escalation is appropriate.
Related Pages
| Page | Description |
|---|---|
kill | The signal-sending foundation |
pkill | Kill by pattern, with richer matching options |
pgrep | Find the PIDs (and names) killall would target |
ps | Verify what is still running |
killall Cheatsheet
| Task | Command |
|---|---|
| Kill every instance by name | killall firefox |
| Force-kill | killall -9 firefox |
| Reload a daemon’s config | killall -HUP nginx |
| Strict exact-name match | killall -e name |
| Confirm before killing | killall -i name |
| Verbose output | killall -v name |
| Wait for exit | killall -w name |
| List signals | killall -l |