vi
) running. How do I kill them all in one single shot/one line command/one command?killall vi
killall -9 vi
pkill
is what I recommend, if it's available (Linux, FreeBSD, NetBSD, OpenBSD, Solaris). You can specify processes by the command name, by the full command line or other criteria. For example, pkill vi
kills all programs whose command name contains the substring vi
. To kill only processes called vi
, use pkill -x vi
. To kill only processes called vi
with a last argument ending in .conf
, use pkill -fx 'vi.*.conf'
.pkill
would send a signal to, use pgrep
, which has exactly the same syntax except that it doesn't accept a signal name or number. To see more information about these processes, runps -p $(pgrep -d, …)
instead (that's a bug: Linux's ps
isn't POSIX-compliant).fuser
; use fuser -k
to send them a signal. For example, fuser -k /usr/bin/find
kills all running isntances of find
.ps -o pgid
(plus any option to select which process(es) to display). If you determine that you want to kill the process group leader 1234 and all its children, run kill -1234
or kill -HUP -1234
or any other signal.ps
with proper options to list all processes and filter it with grep
or some other text filtering command. Take care not to accidentally match other processes that happen to be running a command with a similar name, or with an argument that contains that name. For example:grep
or awk
command itself may be listed in the ps
output (ps
and the filtering command are started in parallel, so whether it will show up or not is dependent on timing). This is particularly important if the command arguments are included in the ps
output.pkill
is very nice here. You can give it lots of parameters to refine the pattern.kill
without piping. On Arch Linux I usekill -9 $(pidof <proc name>)
pkill
.ps -ef | pkill -f command
pgrep
:ps -ef | pgrep -f command
pgrep 'name-of-application' | xargs kill -9
process1abc
process2def
process3ghi
will also get killed.