killall
Send a signal to all processes matching a name
By CMD Script Team · 4 min read · Last updated
killall [OPTIONS] NAME...Options
| Flag | Description |
|---|---|
-9 | Send SIGKILL instead of the default SIGTERM, force-terminating all matches |
-i | Interactive mode: ask for confirmation before signaling each matching process |
-u | Only match processes owned by a given user, e.g. -u alice |
-w | Wait for all signaled processes to actually terminate before returning |
-l | List all available signal names |
-v | Verbose: report whether the signal was successfully sent |
-e | Require an exact match of the process name rather than a substring match |
Distribution compatibility
- Ubuntu
- Debian
- Fedora
- Arch
- macOS (BSD killall, different default behavior — see tips)
What it does
killall sends a signal (SIGTERM by default, same as kill) to every currently running
process whose command name matches the name you give it, instead of requiring you to look
up and specify a numeric PID. It's especially convenient when several instances of the
same program are running (multiple browser tabs' renderer processes, several worker
processes of the same script) and you want to signal all of them in one command rather
than hunting down each PID individually.
Beginner examples
killall firefox— send SIGTERM to every process namedfirefoxkillall -9 chrome— force-kill every process namedchromekillall -i node— ask for confirmation before killing each matchingnodeprocesskillall -l— list all available signal names
killall -9 chrome
Advanced examples
- Restrict matching to a specific user's processes:
killall -u www-data -9 php-fpm - Wait until all matched processes have actually exited before the command returns:
killall -w -9 stuck_worker - Require an exact name match instead of a substring match:
killall -e -9 my-daemon - See confirmation of what was actually signaled:
killall -v python3 - Gracefully signal all matches, falling back to force if they don't respond:
killall python3; sleep 3; killall -9 python3
killall -w -v -9 stuck_worker
Common mistakes
- Running
killall <name>and accidentally matching more processes than intended because the name is a common substring — e.g.killall pythonmatching every Python-based tool on the box, not just your script. - Confusing
killallwith thekillall5used in some System V-style init shutdown scripts, which is a different tool that kills nearly all processes during shutdown. - Assuming
killall's exact matching behavior is identical across Linux and macOS/BSD — always verify with-i(interactive/confirm) the first time on an unfamiliar system. - Not checking permissions first —
killallcan only signal processes you own unless run as root, sokillall someone_elses_processsilently skips processes you lack permission for while still reporting on the ones you do own.
Tips
- Use
-ithe first time you run akillallcommand you're unsure about — it shows you exactly what would be signaled and lets you confirm or skip each one. - Combine
-uwith a name to scope a kill to just one user's processes, avoiding collateral damage on a shared/multi-tenant system. - Prefer
pkill -f <pattern>overkillallwhen you need to match on the full command line (e.g. a specific script path) rather than just the executable's base name. - Use
-wwhen a script needs to be sure processes have actually stopped (not just that the signal was sent) before proceeding to the next step, like restarting a service.
Best practices
- Default to plain
killall <name>(SIGTERM) before reaching for-9, giving matched processes a chance to shut down cleanly, just as withkill. - Use
-u <user>in shared environments to make sure you only affect processes that belong to the intended account, not similarly named processes owned by others. - In automation, prefer explicit, well-scoped matching (
-efor exact name, orpkill -fwith a precise pattern) over a loose substring match that could catch unrelated processes. - Verify what will be killed with
-ior a precedingpgrep <name>check before runningkillall -9in any environment where an accidental match would be costly.
Try it yourself
A simulated shell with a sample home directory — experiment freely, nothing leaves your browser. Type help to list supported commands.
Real-world use cases
- Restarting all worker processes of a script-based service after a config change:
killall -HUP my_worker(if the workers handle SIGHUP) orkillall my_workerfollowed by the service's restart mechanism. - Cleaning up every leftover instance of a crashed or hung application (e.g. multiple
zombie
chromerenderer processes) with a singlekillall -9 chrome. - Ending all instances of a test or batch script running under a specific user account
during CI cleanup:
killall -u ci-runner -9 test_runner.
Common interview questions
- What's the difference between kill and killall?
killsignals a specific PID;killallsignals every process whose name matches the given string, which is more convenient when multiple instances of the same program are running. - How would you avoid accidentally killing more processes than intended with
killall? Use
-ifor interactive confirmation,-efor exact name matching instead of substring matching, and/or-u <user>to scope by owner. - What's the difference between killall and pkill? Both match by name rather than
PID, but
pkillsupports matching against the full command line (-f), parent process, or terminal using more flexible pattern matching, whereaskillalltypically matches on the executable's base name.
Frequently Asked Questions
What's the difference between killall and kill?
kill signals a process by its numeric PID. killall signals every process whose command name matches the given name, which is more convenient when you don't know (or don't want to look up) the PID, or when there are multiple instances of the same program running.
What's the difference between killall and pkill?
Both match processes by name rather than PID, but pkill supports richer matching (full command line with -f, user, terminal, parent process) via regular expressions, while killall traditionally matches on the exact executable name (or substring on Linux) and is simpler to use for straightforward cases.
Is killall's behavior the same on macOS as on Linux?
No — this is a well-known gotcha. On Linux, killall <name> matches processes by command name. On macOS/BSD, killall behaves similarly but historically some BSD variants required -y/-o age flags for different semantics; always double-check with killall -l or a dry run (-i) before relying on exact behavior across platforms.
How do I confirm before killing each matching process?
Use -i (interactive): killall -i firefox prompts y/n for every matching process before sending the signal.
Cheat sheet
Download a quick-reference cheat sheet for killall.