killall
TLDR
Terminate all processes with a specific name
SYNOPSIS
killall [-signal] [-eiIqrvw] [-u user] [-g group] [-o time] [-y time] [name ...]
DESCRIPTION
killall sends a signal to all processes running the specified command. Unlike kill which requires process IDs, killall works with process names, making it convenient for terminating multiple instances of a program.
By default, killall sends SIGTERM (signal 15), which requests graceful termination. Processes can catch this signal and clean up before exiting. Use SIGKILL (-9) when processes don't respond to SIGTERM, but be aware this prevents cleanup.
Name matching compares against the command name (visible in ps). The -r flag enables regex matching for flexible patterns. With -i, you're prompted before each process is killed.
The -w flag makes killall wait until all processes are actually terminated before returning. This is useful in scripts where you need to ensure processes are stopped before proceeding.
Time-based filtering (-o, -y) allows killing only processes that have been running longer or shorter than specified duration (e.g., "1h" for one hour, "30m" for 30 minutes).
PARAMETERS
-e, --exact
Require exact name match (including path length).-I, --ignore-case
Case-insensitive matching.-i, --interactive
Ask for confirmation before killing.-l, --list
List known signal names.-q, --quiet
Don't complain if no processes were killed.-r, --regexp
Interpret names as extended regular expressions.-s, --signal signal
Send specified signal (name or number).-u, --user user
Kill only processes owned by user.-g, --process-group
Kill the process group instead of process.-v, --verbose
Report if signal was successfully sent.-w, --wait
Wait for killed processes to terminate.-o, --older-than time
Kill processes older than specified time.-y, --younger-than time
Kill processes younger than specified time.-Z, --context pattern
Kill only processes with matching SELinux context.
COMMON SIGNALS
SIGTERM (15)
Graceful termination (default).SIGKILL (9)
Force kill (cannot be caught).SIGHUP (1)
Hangup (often triggers reload).SIGINT (2)
Interrupt (like Ctrl+C).SIGSTOP (19)
Pause process.SIGCONT (18)
Resume paused process.
CAVEATS
Behavior differs between Linux (psmisc) and BSD/macOS versions. On macOS, syntax and options differ significantly. Be careful with common names - killall java might kill more than intended. Root can kill any process; users can only kill their own.
HISTORY
killall originated in BSD Unix. The Linux version is part of the psmisc package, maintained separately and with different features than the BSD version. The command has been a standard Unix utility for decades, though the implementation differences between systems require attention for portable scripts.


