Friday, May 3, 2024
 Popular · Latest · Hot · Upcoming
11
rated 0 times [  11] [ 0]  / answers: 1 / hits: 15976  / 2 Years ago, thu, august 25, 2022, 1:26:38

How to kill firefox from the command line?


I have tried:


pkill firefox # the command was known to work previously
pkill -9 firefox
kill -9 firefox # descibed in https://unix.stackexchange.com/questions/8916/when-should-i-not-kill-9-a-process
bash: kill: firefox: arguments must be process or job IDs
killall firefox #described in https://appuals.com/restart-firefox-command-line/

All in vain.


enter image description here


The output of


ps aux | grep -i firefox | grep -v grep

is


v           2419  1.7  7.7 4026824 458876 ?      Sl   12:56   0:51 /usr/lib/firefox/firefox -new-window
v 2483 0.0 0.6 190540 38684 ? Sl 12:56 0:00 /usr/lib/firefox/firefox -contentproc -parentBuildID 20210927210923 -prefsLen 1 -prefMapSize 246254 -appdir /usr/lib/firefox/browser 2419 true socket
v 2515 0.0 2.0 2407620 119704 ? Sl 12:56 0:01 /usr/lib/firefox/firefox -contentproc -childID 1 -isForBrowser -prefsLen 102 -prefMapSize 246254 -jsInit 286204 -parentBuildID 20210927210923 -appdir /usr/lib/firefox/browser 2419 true tab
v 2553 0.5 2.6 2572708 156816 ? Sl 12:56 0:16 /usr/lib/firefox/firefox -contentproc -childID 2 -isForBrowser -prefsLen 268 -prefMapSize 246254 -jsInit 286204 -parentBuildID 20210927210923 -appdir /usr/lib/firefox/browser 2419 true tab
v 2581 0.0 1.6 2406928 99740 ? Sl 12:56 0:01 /usr/lib/firefox/firefox -contentproc -childID 3 -isForBrowser -prefsLen 4889 -prefMapSize 246254 -jsInit 286204 -parentBuildID 20210927210923 -appdir /usr/lib/firefox/browser 2419 true tab
v 2612 0.3 3.7 2648096 225204 ? Sl 12:56 0:09 /usr/lib/firefox/firefox -contentproc -childID 4 -isForBrowser -prefsLen 5588 -prefMapSize 246254 -jsInit 286204 -parentBuildID 20210927210923 -appdir /usr/lib/firefox/browser 2419 true tab
v 2866 0.0 1.2 2373260 72628 ? Sl 12:58 0:00 /usr/lib/firefox/firefox -contentproc -childID 5 -isForBrowser -prefsLen 5701 -prefMapSize 246254 -jsInit 286204 -parentBuildID 20210927210923 -appdir /usr/lib/firefox/browser 2419 true tab
v 2998 0.0 0.6 194220 39176 ? Sl 13:12 0:00 /usr/lib/firefox/firefox -contentproc -parentBuildID 20210927210923 -prefsLen 5926 -prefMapSize 246254 -appdir /usr/lib/firefox/browser 2419 true rdd

More From » firefox

 Answers
5

tl;dr: pkill -f firefox does the trick.


I found this in the pkill/pgrep manpages:



The process name used for matching is limited to the 15 characters present in the output of /proc/pid/stat. Use the
-f option to match against the complete command line, /proc/pid/cmdline.



With /usr/lib/firefox/firefox having PID 691953 when testing locally on my machine, I found the following in /proc/691953/stat:


691953 (GeckoMain) .... # truncated by me

Doing a pkill GeckoMain killed firefox as promised. killall GeckoMain works too.


The simplest workaround is probably to supply the -f flag to pkill to match against /proc/<pid>/cmdline, which in my case contained /usr/lib/firefox/firefox.


[#1122] Thursday, August 25, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
fishutt

Total Points: 391
Total Questions: 137
Total Answers: 106

Location: Mexico
Member since Tue, Aug 11, 2020
4 Years ago
fishutt questions
Thu, Nov 17, 22, 07:36, 1 Year ago
Mon, Mar 28, 22, 15:09, 2 Years ago
Wed, Feb 8, 23, 06:50, 1 Year ago
Fri, Apr 22, 22, 00:08, 2 Years ago
Wed, May 26, 21, 00:38, 3 Years ago
;