Kill processes by name.
Syntax killall [-delmsvz] [-help] [-u user] [-t tty] [-c procname] [-SIGNAL] [procname ...] Key -d | -v Be more verbose about what will be done. For a single -d option, a list of the processes that will be sent the signal will be printed, or a message indicating that no matching processes have been found. -e Use the effective user ID instead of the (default) real user ID for matching processes specified with the -u option. -help Give a help on the command usage and exit. -l List the names of the available signals and exit, like in kill. -m Match the argument procname as a (case sensitive) regular expression against the names of processes found. CAUTION! This is dangerous, a single dot will match any process running under the real UID of the caller. -s Show only what would be done, but do not send any signal. -SIGNAL Send a different signal instead of the default TERM. The signal can be specified either as a name (with or without a leading SIG), or numerically. -u user Limit potentially matching processes to those belonging to the specified user. -t tty Limit potentially matching processes to those running on the specified tty. -c procname When used with the -u or -t flags, limit potentially matching processes to those matching the specified procname. -z Do not skip zombies. This should not have any effect except to print a few error messages if there are zombie processes that match the specified pattern.
Sending a signal to all processes with uid XYZ is already supported by kill. So use kill for this job (e.g. $ kill -TERM -1 or as root $ echo kill -TERM -1 | su -m user)
Common Kill Signals Signal name Signal value Effect SIGHUP 1 Hangup SIGINT 2 Interrupt from keyboard SIGQUIT 3 Quit SIGABRT 6 Abort SIGKILL 9 Kill signal SIGTERM 15 Termination signal - allow an orderly shutdown SIGSTOP 17,19,23 Stop the process
0 Success
1 No matching process has been found or not all processes have been signalled successfully.
2 Command error.
Examples
Check if the process ss64 is running:
$ $ ps -aef | grep ss64
If so, kill it:
$ killall ss64
Kill two processes at once:
$ killall process1 p
Flush the DNS cache, the mDNSResponder will automatically restart.
# MacOS 10.7, 10.8, and 10.9, 10.10.4 and above: $ sudo killall -HUP mDNSResponder # for older (pre 2009) versions of macOS see dscacheutil # Tip: You can use an alias to save remembering long commands: $ alias flushdns='sudo killall -HUP mDNSResponder'
"Love never dies a natural death. It dies because we don't know how to replenish it's source. It dies of blindness and errors and betrayals.
It dies of illness and wounds; it dies of weariness, of witherings, of tarnishings" ~ Anais Nin
Related macOS commands:
ctrl+z / ctrl+c - Suspend/Interrupt a program
ps - List running processes (returns PID)
pkill - Kill processes by a full or partial name.
kill - Kill a process by specifying its PID.
sigaction(2)
lsof - List open files