GNUs Not U 2

January 28, 2007 on 1:16 am | In Unix |

Kill a command by name:

ps axc | grep httpd | awk '{ print $1; }' | xargs kill

Look for a command exclude your own grep:

ps auxwww | grep command | grep -v grep

Kill a command based on it’s arguments:

ps axwww | grep port=8889 | grep -v grep | awk '{ print $1; }' | xargs kill

Can this be simplified?:

ps axc | awk '/httpd/{ print $1 }' | xargs kill

ps axwww | awk '/port=8889/{ print $1 }' | xargs kill

But when using the command above we are trying to kill our own awk command!

ps axwww | awk '/port=8889/ && !/awk/ { print $1 }' | xargs kill

No Comments yet »

RSS feed for comments on this post. TrackBack URI

Leave a comment

XHTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>

Powered by Cheese.     RSS Entries Feed.     RSS Comments Feed     ^Top^