Skip to main content

killall

The killall command sends a signal to all processes running any of the specified commands. It is very similar to pkill, but differs in its default matching behavior and origin (it's part of the psmisc package).

Note: On Solaris systems, killall kills absolutely every process on the system, bringing it down. On Linux, it only kills processes matching the name. Always be careful!

Basic Syntax

killall [OPTIONS] COMMAND_NAME...

Common Flags/Options

By default, killall sends SIGTERM (15).

OptionDescription
-SIGNALSend a specific signal (e.g., -9 or -SIGKILL).
-u USERKill only processes the specified user owns.
-e, --exactRequire an exact match for very long names.
-I, --ignore-caseDo case-insensitive process name matching.
-i, --interactiveAsk for confirmation before killing each process.
-y, --younger-than TIMEKill processes younger than a specified time (e.g., 5m for 5 minutes).
-o, --older-than TIMEKill processes older than a specified time.

Real-world Examples

1. Kill all instances of a program

If you have multiple Nginx worker processes and want to stop all of them:

sudo killall nginx

2. Ask for confirmation (Interactive mode)

If you are unsure how many processes might be affected and want to be safe, use -i.

killall -i bash

Output:

Kill bash(1054) ? (y/N) n
Kill bash(2098) ? (y/N) y

3. Kill processes older than a certain time

This is incredibly useful for cleaning up hung scripts or old connections. For example, to kill all php-fpm processes that have been running for more than 2 hours:

sudo killall -o 2h php-fpm

4. Send a specific signal

To forcefully terminate all instances of a crashing program:

killall -9 chrome