//View Tip #191
Similar Tips
» Check low space
» Graph connections to hosts
» Moved Trac and Subversion repositories to another machine/direct
» Get your IP address
» List non-system users

 

Latest tips by RSS
Click here to subscribe
Follow Shell-Fu on Twitter
Click here to follow
Follow Shell-Fu on identi.ca
Click here to follow
ps | grep processName | grep -v grep | awk '{print "kill -9 " $2}' | sh


Take the '| sh' off the end before running to check the commands that will be run.


View Comments »




Comments 

Add your comment

Comments are currently disabled
Not sure this even works. And it's poorly written. If you do this:
ps | grep bash | grep -v grep | awk '{print "kill -9 " $2}'

for example, you get this output:
kill -9 pts/2

because the output of
ps | grep bash | grep -v grep

is

14814 pts/2    00:00:00 bash

Which means you would need to do

ps | grep bash | grep -v grep | awk '{print "kill -9 " $1}'

to get the correct command. However this is poorly written and would be a lot nicer as:

ps -C processname -o pid= | awk '{print "kill -9 " $1}' | sh

and even that could be reduced a lot, I'm sure
Posted 2008-10-02 16:36:51
hey... try the following:

$ killall ProcessName

$ fuser -k `which ProcessName`
Posted 2008-10-25 18:08:29
Ive
Try to use pkill command. That's pretty ease
>$ pkill ProcessName
Posted 2008-10-25 21:10:39
ps ax | grep processName | grep -v grep | awk '{print $1}'|xargs kill -15

Soft kill
Posted 2009-08-05 09:28:36

Home Latest Browse Top 25 Random Hall Of Fame Contact Submit