Skip to content
Tutorials Center
My learning

Topics

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.

Terminal
killall [OPTION]... NAME...
killall -l

Try it

Bash Stop every process with one name

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.

Bash Choosing the signal and checking existence

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

Terminal
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 name lists what would match, and killall -i or -v shows what is hit.
  • Exact names. A script run as python3 app.py has the process name python3, so killall python3 stops every Python 3 program you own. To target one script use pkill -f app.py.
  • Permissions. You can only signal your own processes unless you are root, so a normal user's killall never touches other users' programs.
  • SIGTERM is not a guarantee. A program can catch it, or be stuck in uninterruptible sleep. Try TERM, wait, and only then KILL (which cannot be caught and skips cleanup).
  • Reload instead of stop. killall -HUP nginx asks many daemons to re-read their configuration.
  • -w can wait forever if the process ignores the signal; combine with timeout.
  • Portability. The Linux (psmisc) killall is the one described here; the options differ on BSD, macOS and Solaris.