How to Kill All Processes With a Given Partial Name

How to kill all processes with a given partial name?

Use pkill -f, which matches the pattern for any part of the command line

pkill -f my_pattern

Just in case it doesn't work, try to use this one as well:

pkill -9 -f my_pattern

How to kill all processes matching a name?

From man 1 pkill

-f     The pattern is normally only matched against the process name.
When -f is set, the full command line is used.

Which means, for example, if we see these lines in ps aux:

apache   24268  0.0  2.6 388152 27116 ?        S    Jun13   0:10 /usr/sbin/httpd
apache 24272 0.0 2.6 387944 27104 ? S Jun13 0:09 /usr/sbin/httpd
apache 24319 0.0 2.6 387884 27316 ? S Jun15 0:04 /usr/sbin/httpd

We can kill them all using the pkill -f option:

pkill -f httpd

How can I kill a process by name instead of PID, on Linux?

pkill firefox

More information: http://linux.about.com/library/cmd/blcmdl1_pkill.htm

Kill all processes by command

Try this

ps aux | grep 'ssh-agent -s' | awk '{print $2'} | xargs kill -9

How to kill all processes with the same name using OS X Terminal

use pkill, with the -f option.

pkill -f python

If you don't have pkill pre-installed (some osx's don't...), try proctools.

Kill all processes by command

Try this

ps aux | grep 'ssh-agent -s' | awk '{print $2'} | xargs kill -9


Related Topics



Leave a reply



Submit