Linux Command Reference ยท Processes and Signals
Linux killall command
Reference for the Linux killall command: send a signal to every process with an exact name, choose the signal, ask before killing, wait for exit and avoid common traps.
killall sends a signal to every process whose command name matches the name you give. By default the signal is SIGTERM, a polite request to exit. It is kill with names instead of process IDs, which is handy when a program has several workers and you want all of them gone.
The match is on the exact process name, not on a pattern. killall node stops processes named node and leaves nodemon alone. For pattern matching on the full command line use pkill. On some other Unix systems (Solaris, older System V) killall means "kill every process you can", so never type it there without checking.
killall [OPTION]... NAME...
killall -l
Try it
Press Run (or Ctrl + Enter) to see the result here.
Program input ยท what you'd type while the program runs
Type the answers before you press Run, one per line. Each time the program reads a line (with read or cat), it gets the next line from this box.
Press Run (or Ctrl + Enter) to see the result here.
Program input ยท what you'd type while the program runs
Type the answers before you press Run, one per line. Each time the program reads a line (with read or cat), it gets the next line from this box.
Syntax
killall [-e] [-I] [-i] [-q] [-r] [-s SIGNAL | -SIGNAL] [-u USER] [-v] [-w] NAME...
| Option | Description |
|---|---|
-s SIGNAL, -SIGNAL |
Signal to send, by name or number. -HUP, -s HUP and -1 are the same. Default TERM. |
-i |
Interactive: ask before each kill. |
-I |
Match names case-insensitively. |
-q |
Quiet: do not complain when no process matched. |
-r |
Treat NAME as a regular expression. |
-u USER |
Only processes owned by USER. |
-v |
Report each signal that was sent. |
-w |
Wait until all signalled processes have died (it polls). |
-0 |
Send nothing; the exit status says whether a process matches. |
-l |
List known signal names. |
Returns: 0 if at least one process was signalled, non-zero otherwise (with the message demo-worker: no process found).
Edge case: names longer than 15 characters are matched against the executable file instead, because the kernel truncates the process name to 15 bytes.
Usage notes
- Check first.
pgrep -l namelists what would match, andkillall -ior-vshows what is hit. - Exact names. A script run as
python3 app.pyhas the process namepython3, sokillall python3stops every Python 3 program you own. To target one script usepkill -f app.py. - Permissions. You can only signal your own processes unless you are root, so a normal user's
killallnever touches other users' programs. SIGTERMis not a guarantee. A program can catch it, or be stuck in uninterruptible sleep. TryTERM, wait, and only thenKILL(which cannot be caught and skips cleanup).- Reload instead of stop.
killall -HUP nginxasks many daemons to re-read their configuration. -wcan wait forever if the process ignores the signal; combine withtimeout.- Portability. The Linux (psmisc)
killallis the one described here; the options differ on BSD, macOS and Solaris.