Topics

Archives

Handy References


« | Main | »

Automating process killing…

By Matt | September 10, 2009

The one-liner:  ps -ef | grep http_load | grep -v grep | awk ‘{print $2}’ | xargs kill

The in-depth explanation:

ps -ef | grep http_load lists all the processes with http_load in their name.  That’s the processes I want to kill.

grep -v grep removes from that process list the process which listed the other processes.

awk ‘{print 2}’ grabs the process id

Piping it to xargs kill …kills it.  Nice and neat. 

I love a nice, simple evil line of BASH.

Topics: Uncategorized | No Comments »

Comments

You must be logged in to post a comment.