This is a nice way to kill processes.. the example below is for firefox!!! substitute firefox for whatever the process name is...

ps aux | grep -i firefox | grep -v grep | awk '{print $2}' | xargs -t -i kill -9 {}
This is a nice way to kill processes.. the example here is for firefox!!! substitute firefox for whatever the process name is...
Sample Output
kill -9 7491 
kill -9 7506 
kill -9 7434 
kill -9 7532

-7
By: blackdude
2009-02-19 18:50:00

What Others Think

does killall -9 firefox not work for you?
chops · 649 weeks and 2 days ago
and how is kill -9 the "nice way to kill processes"?
chops · 649 weeks and 2 days ago
killall firefox works just as nicely Keep It Simple Stupid (KISS)
nottings · 649 weeks and 2 days ago
pkill firefox xoxo
Williebee · 649 weeks and 1 day ago
Instead of using this long drawn-out command all the time, use a script and change the "firefox" to "$1", so you get in the script file: ps aux | grep -i $1 | grep -v grep | awk '{print $2}' | xargs -t -i kill -9 {} That way, you can run it as: ./ firefox OR (if you put it in teh bin) firefox
farglenargle · 648 weeks and 2 days ago
Whoops, meant to do: ./(scriptname) firefox or (scriptname) firefox (I'm such a scatterbrain)
farglenargle · 648 weeks and 2 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: