Kill all processes related to an application
Solution 1
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
Solution 2
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;
Related videos on Youtube
David542
Updated on September 18, 2022Comments
-
David542 almost 2 years
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
orFirefox
?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
-
MacLovin about 12 years$ sudo killall Firefox No matching processes were found
-
MacLovin about 12 yearsCorrected to
killall firefox
, the process that is actually running is thefirefox
binary inside the Firefox.app bundle. -
Admin about 12 yearsI don't have pkill or pkill on my machine. How would I do the same with
killall
? -
MacLovin about 12 years
killall firefox-bin
should work for you. At least Firefox 13 usesfirefox
as process name.