kill processes by name.

      killall [option(s)] [--] name ...

      killall -l

      killall -V,--version 


   --exact  Require an exact match for very long names.
            If a command name is longer than 15 characters, the full name might be
            unavailable (i.e. it is swapped out). In this case, killall will kill everything
            that matches within the first 15 characters. With -e, such entries are skipped. 
            killall prints a message for each skipped entry if -v is specified in addition to -e, 

            Kill the process group to which the process belongs.
            The kill signal is only sent once per group, even if multiple processes belonging
            to the same process group were found.

            Do case insensitive process name match.
            Interactively ask for confirmation before killing.

   --list   List all known signal names.

   name     The command/process to be killed

   --quiet  Do not complain if no processes were killed.
   --regexp Interpret process name pattern as an extended regular expression.
   -s signal
   --signal signal
            Send signal instead of the default SIGTERM. See list below.
            e.g. -s 9 = SIGKILL

   -u user
   --user user
            Kill only processes the specified user owns. Command names are optional.

            Report if the signal was successfully sent.

            Display version information.
   --wait   Wait for all killed processes to die. killall checks once per second if any
            of the killed processes still exist and only returns if none are left.
            Note that killall can wait forever if the signal was ignored, had no effect, or
            if the process stays in zombie state. 

   -Z pattern
   --context pattern 
            Specify security context: kill only processes having security context that match
            with given expended regular expression pattern. Must precede other arguments on
            the command line. Command names are optional. (SELinux Only)

   --       Each parameter after a '--' parameter is always interpreted as a non-option parameter.

killall sends a signal to all processes running any of the specified commands. If no signal name is specified, SIGTERM is sent.

Signals can be specified either by name (e.g. -HUP) or by number (e.g. -1) or by option -s.

If the command name is not regular expression (option -r) and contains a slash (/), processes executing that particular file will be selected for killing, independent of their name.

killall returns a zero return code if at least one process has been killed for each listed command, or no commands were listed and at least one process matched the -u and -Z search criteria. killall returns non-zero otherwise.

A killall process never kills itself (but can kill other killall processes).

Common Kill Signals
Signal name Signal value Effect
SIGHUP 1 Hangup
SIGINT 2 Interrupt from keyboard
SIGABRT 6 Cancel
SIGKILL 9 Kill signal
SIGTERM 15 Termination signal - allow an orderly shutdown
SIGSTOP 17,19,23 Stop the process

location of the proc file system

Known Bugs

Typing killall name might not have the desired effect on non-Linux systems, especially when done by a privileged user. e.g. on Solaris it will kill all active processes.

Killing by file only works for executables that are kept open during execution, i.e. impure executables can’t be killed this way.

killall -w doesn’t detect if a process disappears and is replaced by a new process with the same PID between scans.

If processes change their name, killall might not be able to match them correctly.


Kill firefox:

$ killall -9 mozilla-bin

“If future generations are to remember us with gratitude rather than contempt, we must leave them more than the miracles of technology. We must leave them a glimpse of the world as it was in the beginning, not just after we got through with it” ~ President Lyndon B. Johnson

Related Linux commands

ctrl+z / ctrl+c - Suspend/Interrupt a program.
kill - Kill a process by specifying its PID.
ps - List running processes (returns PID).
pkill - Kill processes by a full or partial name.
fuser - identify processes using files or sockets.
jobs - List your own processes (returns Job No.)
bg - Put a process in the background.

Copyright © 1999-2024
Some rights reserved