I have two processes that are temporarily spawned and I need to kill them. Here are the processes from ps aux

david  38329   0.0  5.0  3916476 104624 s002  S    11:33AM   0:17.43 /Applications/Firefox.a
david  38319   0.0  0.0  2442472   1028 s002  S    11:33AM   0:00.10 Xvfb -br -screen 0 800x
david  38268   0.0  0.2  3012352   4960   ??  S    11:02AM   0:00.24 /System/Library/Framewo
david  38261   0.0  3.4  3913364  70724 s002  S    11:02AM   0:08.51 /Applications/Firefox.a

How would I kill all processes that are either Xvfb or Firefox ?

Update: I was able to use $ sudo killall Xvfb to kill that process, but am still having trouble doing the same with Firefox:

davids-Mac-mini:financials david$ ps aux|grep firefox
david          /Applications/Firefox.app/Contents/MacOS/firefox-bin -foreground
david          /Applications/Firefox.app/Contents/MacOS/firefox-bin -foreground
david          grep firefox
davids-Mac-mini:financials david$ sudo killall firefox
No matching processes were found

3 Answers 3


If you want to do it by name:

killall firefox

If you want to kill a specific process, e.g. the first Firefox instance:

kill 38329

and if the process doesn't want to go, you can use:

kill -KILL 38261

There should be no way for a program to keep the OS from terminating it RIGHT NOW.

Update: To see a list of all available process names for the killall command, you can use:

ps -axco command | sort | uniq
  • $ sudo killall Firefox No matching processes were found
    – David542
    Commented May 18, 2012 at 20:53
  • Corrected to killall firefox, the process that is actually running is the firefox binary inside the Firefox.app bundle.
    – Orangenhain
    Commented May 18, 2012 at 20:56
  • Please see update in question.
    – David542
    Commented May 18, 2012 at 20:58
  • 1
    killall firefox-bin should work for you. At least Firefox 13 uses firefox as process name.
    – Orangenhain
    Commented May 18, 2012 at 21:01

You could do

kill `pgrep Xvfb` `pgrep Firefox`

You can add -f to search the entire command, in case it doesn't find it without the -f.

pgrep -f Firefox 

There is also pkill which takes the same input as pgrep

pkill Xvfb; pkill -f Firefox;
  • I don't have pkill or pkill on my machine. How would I do the same with killall ?
    – David542
    Commented May 18, 2012 at 20:58

This function kills all processes related to an application. You can call it like this: killapp chrome

killapp () {
    processes=($(pidof $1))
    for pid in $processes
            kill -9 $pid

If you are in macos and don't have pidof installed you can install it with brew or use pgrep instead.

I think pidof works best since it finds all processes related to a given application whereas it is not always the case with pgrep.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .