i can’t believe this worked the first time

so i wrote this on a server today hoping to kill off a bunch of duplicated processes that were locked up… as the title states, it worked the first time! i think this will work in most linux distros that have the -ef flag for the ps command:

ps -ef | grep -v grep | grep [runaway process]| awk ‘{print $2}’ | xargs kill -9

in a nutshell, it prints out the process id from the ps command and uses xargs to pipe it to the kill process.

whew! it saved me a ton of typing, so i thought i’d share.

-m

Posted in Code/Programming, Geeky Stuff, Work at April 23rd, 2008. Trackback URI: trackback

No Responses to “i can’t believe this worked the first time”

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>