killall command
killall
- kill processes by name
The killall
command in Linux is a utility used to terminate processes by name rather than by process ID (PID), unlike the kill
command. It’s a convenient way to stop all instances of a program (e.g., a crashed application) without needing to look up PIDs individually.
Usage: killall [options] [name...]
name
: The name of the process(es) to terminate (e.g.,firefox
,bash
).options
: Flags to modify behavior or specify signals.
Examples
-
Basic Usage
Send the default signal (
SIGTERM
) to all processes with a given name.killall firefox
- Terminates all running Firefox processes.
SIGTERM
requests graceful shutdown, allowing cleanup.
-
Forcing Termination
Use
-9
(or-SIGKILL
) to forcefully stop processes.killall -9 firefox
- Sends
SIGKILL
to all Firefox processes, stopping them immediately without cleanup. - Use this when
SIGTERM
fails.
- Sends
-
Specifying Signals
Like
kill
,killall
supports various signals using-SIGNALNAME
or-NUMBER
.Common Signals:
Signal Number Description SIGTERM
15 Terminate gracefully (default) SIGKILL
9 Force immediate termination SIGHUP
1 Hang up (reload config for some daemons) SIGINT
2 Interrupt (like Ctrl+C) killall -SIGHUP nginx
- Sends
SIGHUP
to reload Nginx configuration.
With Number:
killall -1 nginx
- Same as above.
- Sends
-
Case-Insensitive Matching
Use
-i
to ignore case when matching process names.killall -i FIREFOX
- Kills processes named
firefox
,Firefox
, orFIREFOX
.
- Kills processes named
-
Exact Match
Use
-e
to require an exact process name match (avoids partial matches).killall -e bash
- Only kills
bash
, notmybashscript
or similar.
- Only kills
-
Verbose Output
Use
-v
to see which processes are being killed.killall -v firefox
- Output:
killed firefox(1234)
,killed firefox(5678)
.
- Output:
-
Listing Signals
Use
-l
to list available signals.killall -l
- Output (partial):
HUP INT QUIT KILL TERM ...
.
- Output (partial):
To get help related to the killall
command use --help
option
$ killall --help
Usage: killall [OPTION]... [--] NAME...
killall -l, --list
killall -V, --version
-e,--exact require exact match for very long names
-I,--ignore-case case insensitive process name match
-g,--process-group kill process group instead of process
-y,--younger-than kill processes younger than TIME
-o,--older-than kill processes older than TIME
-i,--interactive ask for confirmation before killing
-l,--list list all known signal names
-q,--quiet don't print complaints
-r,--regexp interpret NAME as an extended regular expression
-s,--signal SIGNAL send this signal instead of SIGTERM
-u,--user USER kill only process(es) running as USER
-v,--verbose report if the signal was successfully sent
-V,--version display version information
-w,--wait wait for processes to die
-n,--ns PID match processes that belong to the same namespaces
as PID
-Z,--context REGEXP kill only process(es) having context
(must precede other arguments)
For more details, check the manual with man killall