killall Command Cheat Sheet
killall sends a signal to all processes running any of the specified commands. It is handy when multiple instances of a program are running (e.g., chrome, httpd).
⚠️ Warning: On some Unix systems (like Solaris/AIX), killall kills ALL processes on the system (Shutdown). On Linux, it kills by name.
Synopsis
killall [OPTIONS] [NAME...]
Basic Usage
Terminate All Instances
Terminates all processes named firefox.
killall firefox
Force Kill All Instances
killall -9 firefox
killall -SIGKILL firefox
Targeting Specifics
By User (-u)
Kill only nginx processes owned by www-data.
sudo killall -u www-data nginx
By Time (Younger/Older)
Kill processes running for less than 30 minutes.
killall -y 30m infinite_loop_script
Kill processes running for more than 1 week.
killall -o 1w obsolete_daemon
Interactive & Safety
Interactive Mode (-i)
Ask for confirmation before killing each process.
killall -i firefox
# Output: Kill firefox(1234) ? (y/N)
Dry Run (Verbose)
Use -v to report if the signal was sent successfully. killall doesn't strictly have a "dry run" flag like make, but standard practice to check what would match is using pgrep -a name.
However, killall -v shows what happens:
killall -v firefox
# Output: Killed firefox(1234) with signal 15
Regex Matching (-r)
Interpret the process name pattern as an extended regular expression.
# Kill all processes starting with "php"
killall -r "^php"
Exit Status
| Code | Meaning |
|---|---|
| 0 | Success (at least one process killed) |
| 1 | No matching process found |
Comparison: killall vs pkill
| Feature | killall |
pkill |
|---|---|---|
| Match by | Exact Name (default) | Pattern / Partial (default) |
| Regex | Yes (-r) | Yes (default) |
| Interactive | Yes (-i) | No |
| Package | psmisc | procps |
Notes
- Exact Match: By default,
killall apachewill NOT killapache2. It requires an exact match. - Process Group: Unlike
kill,killalloperates on names, not PIDs or Job IDs.