LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 03-15-2008, 03:18 PM   #1
pppaaarrrkkk
Member
 
Registered: Jun 2005
Location: Aylesbury UK
Distribution: Fedora 9
Posts: 100

Rep: Reputation: 15
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.
 
Old 03-15-2008, 03:24 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,378

Rep: Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963
pkill firefox-bin

;-)
 
Old 03-18-2008, 06:51 PM   #3
win32sux
Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 371Reputation: 371Reputation: 371Reputation: 371
Quote:
Originally Posted by acid_kewpie View Post
pkill firefox-bin
I've always used:
Code:
killall firefox-bin
Which one is better?
 
Old 03-19-2008, 07:09 PM   #4
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 70
Quote:
Originally Posted by win32sux View Post
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).
 
Old 03-19-2008, 07:17 PM   #5
win32sux
Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 371Reputation: 371Reputation: 371Reputation: 371
Quote:
Originally Posted by osor View Post
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!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
awk question on handling *.CSV "text fields" in awk jschiwal Programming 8 05-27-2010 06:23 AM
Sed/Awk: print lines between n'th and (n+1)'th match of "foo" xaverius Programming 17 08-20-2007 11:39 AM
Replacing "function(x)" with "x" using sed/awk/smth Griffon26 Linux - General 3 11-22-2006 10:47 AM
suse 10.0 => processes "sending kill signal": "done, done, missing"...!? ungua Linux - Newbie 2 01-18-2006 10:52 AM
"Undeleting" data using grep, but get "grep: memory exhausted" error SammyK Linux - Software 2 03-13-2004 03:11 PM


All times are GMT -5. The time now is 03:18 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration