killall

kill processes by command name

GNU version OS X
killall [-Z,--context pattern] [-r,--regexp] [-I,--ignore-case] [-e,--exact]
        [-u,--user user] [-g,--process-group] [-i,--interactive]
        [-o,--older-than time] [-y,--younger-than time]
        [-v,--verbose] [-w,--wait] [-q,--quiet] [-V,--version] [-s,--signal sig]   [--] command
killall -l
killall -V,--version

Sends a signal to all processes running any of the specified commands. Default signal SIGTERM.
Signals can be specified either by name (e.g. -HUP or -SIGHUP ) or by number (e.g. -1) or by option -s.

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

-i
--interactive
ask for confirmation before killing.
-e
--exact
Require an exact match for long names.
If a command name is longer than 15 characters, the full name may 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 and displays a message for each skipped entry if -v is specified
-I
--ignore-case
Do case insensitive process name match.
-u uid
--user uid
Kill processes the specified user owns. command is optional!
-g g
--process-group g
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.
-o nn.nu (ago)
--older-than nn.nu (ago)
Match only processes that are older (started before) nn.nu.
The time is specified as a float then a unit. The units are s,m,h,d,w,M,y for seconds, minutes, hours, days, weeks, Months and years respectively.
-y nn.nu (ago)
--younger-than nn.nu (ago)
Match only processes that are younger (started after) …
-q
--quiet
Do not complain if no processes were killed.
-r
--regexp
Interpret process name pattern as an extended regular expression.
-l
--list
List all known signal names.
HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM URG STOP 
TSTP CONT CHLD TTIN TTOU IO XCPU XFSZ VTALRM PROF WINCH INFO USR1 USR2
-s
--signal sig
Send this signal default of SIGTERM.
-v
--verbose
Report if the signal was successfully sent.
-V
--version
Display version information.
-w
--wait
Wait for all killed processes to die. Checks once per second if any of the killed processes still exist and only returns if none are left.
Note that killall may continue to wait if signal was not TERM, was ignored, had no effect, or if the process stays in zombie state.
-Z
--context
(SELinux Only) 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.

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 never kills itself (but may kill other killall processes)!

Error messages

No matching processes belonging to you were found

files

/proc location of the proc file system

KNOWN BUGS

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

Be warned that typing killall name may not have the desired effect on non-Linux systems, especially when done by a privileged user.

killall --wait 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 may not be able to match them correctly.

limit of names that can be specified on the command line. This is the size of an unsigned long multiplied by 8. For most 32 bit systems the limit is 32 and similarly for a 64 bit system the limit is usually 64.

SEE ALSO

kill(1), fuser(1), pgrep(1), pidof(1), pkill(1), ps(1), kill(2)

BSD Mac OSX

killall [-delmsvz] [-help] [-u user] [-t tty] [-c procname] [-SIGNAL] [procname ...]

Issues SIGTERM against processes (selected by name as opposed to pid as kill), with a real UID of the caller, matching procname.
The super-user is allowed to killall any process.

-s Show what would be done, (do not send any signal).
-d
-v
Be more verbose about what will be done.
For a single -d a list of processes that will be signaled is output
-e Effective user ID instead of the real user ID for match with -u
-u user match processes belonging to the specified user.
-t tty match processes on tty.
-c procname with -u or -t , match procname.
-help
 > killall -help
usage: killall [-delmsvz] [-help]
               [-u user] [-t tty] [-c cmd] [-SIGNAL] [cmd] …
At least one option or argument to specify processes must be given.
-l List the names of the available signals
HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM URG STOP TSTP CONT CHLD TTIN TTOU IO XCPU XFSZ VTALRM PROF WINCH INFO USR1 USR2 .
bash trap details these.
-m Match procname as a (case sensitive) regular expression.
CAUTION! A single dot will match any process running under the real UID of the caller.
-SIGNAL sig Signal specified as a name (with or without leading SIG), or numerically(avoid) instead of the default TERM.
-z zombies are included. This should not have any effect except to output a few error messages if there are zombie processes that match the specified pattern.

ALL PROCESSES

Sending a signal to all processes with uid UID is supported by kill(1).
Example:
kill -hup -1
or
as root
$ echo kill -hup -1 | su -m user

EXIT STATUS

2 a command error.
1 no matching process found or not all processes have been signalled successfully.
0 will be returned.

DIAGNOSTICS

Diagnostic messages will only be printed if requested by -d

pgrep, pkill

find or signal processes by name

pgrep [-Lafilnoqvx] [-F pidfile] [-G gid] [-P ppid] [-U uid] [-d delim] [-g pgrp] [-t tty] [-u euid] pattern …

pkill [-signal] [-ILafilnovx] [-F pidfile] [-G gid] [-P ppid] [-U uid] [-g pgrp] [-t tty] [-u euid] pattern …

pgrepi searches the process table on the running system and outputs the process IDs of processes that match the criteria

pkill " … " then sends a signal to them.

-I Request confirmation before signaling each process.
-F pidfile Restrict matches to a process whose PID in pidfile
-L pidfile for -F must be locked with the flock(2) syscall or created with pidfile(3).
Restrict Matches to processes in the list of
-G gid[, gid … ] real group IDs
-P ppid[, ppid …] parent process ID
-U uid[, uid …[ real user ID
-u euid[, euid …] effective user ID
-g pgrp[, pgrp …] process group ID .
zero means the process group ID of the running pgrep or pkill
-t tty[, tty …] associated with terminals .
Terminal names may be of the form ttynn or nn.
A dash (-) matches processes not associated with a terminal.
-o Select oldest (least recently started) of the matces
-n Select newest (most recently started) of the matches
-i Ignore case in both the process table and pattern.
-a Include process ancestors in the match list. By default, the current pgrep or pkill process and all of its ancestors are excluded (unless -v is used).
-f Match against full argument lists. The default is to match against process names.
-x Require an exact match of the process name, or argument list if -f is given. The default is to match any substring.
-l Long output.
For pgrep, output the process name in addition to the ID for each matching process. with -f, output the process ID and the full argument list for each matching process.
For pkill, display the kill command used for each process killed.
-d delim delimiter to be output between process IDs for pgrep. default :newline.
-q Quite. Do not write anything to standard output.
-v Reverse the sense of the matching; ie select those that do not match the given criteria.
-signal sig A non-negative decimal number or symbolic signal name specifying the signal to be sent Default: TERM.
Must be first argument to pkill if included

If any pattern operands are specified, they are used as regular expressions to match the command name or full argument list of each process.

Does not match itself.

EXIT STATUS

0 One or more processes were matched.
1 No processes were matched.
2 Invalid options were specified on the command line.
3 An internal error occurred.

SEE ALSO

kill(1), killall(1), ps(1), flock(2), kill(2), sigaction(2), pidfile(3), re_format(7)