LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   How do you do ps ax | grep mozilla | awk '{print "kill " $1}' (https://www.linuxquestions.org/questions/programming-9/how-do-you-do-ps-ax-%7C-grep-mozilla-%7C-awk-%7Bprint-kill-%241%7D-628300/)

pppaaarrrkkk 03-15-2008 03:18 PM

How do you do ps ax | grep mozilla | awk '{print "kill " $1}'
 
How do you close all open instances of an app using something like :


ps ax | grep firefox | awk '{print "kill " $1}'



You can do the following :





ps ax | grep firefox | awk '{print "kill " $1}' > do_this.sh

chmod a+x do_this.sh
do_this.sh




........., which is what I usually do, but I don't suppose it's the standard way.

acid_kewpie 03-15-2008 03:24 PM

pkill firefox-bin

;-)

win32sux 03-18-2008 06:51 PM

Quote:

Originally Posted by acid_kewpie (Post 3089756)
pkill firefox-bin

I've always used:
Code:

killall firefox-bin
Which one is better?

osor 03-19-2008 07:09 PM

Quote:

Originally Posted by win32sux (Post 3093244)
Which one is better?

Well, pkill is more “portable” in the sense that pkill usually does almost the same thing on Linux, Solaris, and BSD. The killall utility of linux is different from the killall utility of Solaris (the latter will attempt to kill all processes on the system—somewhat like the killall5 utility distributed with some linux versions of init).

win32sux 03-19-2008 07:17 PM

Quote:

Originally Posted by osor (Post 3094376)
Well, pkill is more “portable” in the sense that pkill usually does almost the same thing on Linux, Solaris, and BSD. The killall utility of linux is different from the killall utility of Solaris (the latter will attempt to kill all processes on the system—somewhat like the killall5 utility distributed with some linux versions of init).

Interesting. Thanks!


All times are GMT -5. The time now is 01:31 AM.