如何从命令行杀死火狐浏览器?
我努力了:
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/
Run Code Online (Sandbox Code Playgroud)
一切都是徒劳。
的输出
ps aux | grep -i firefox | grep -v grep
Run Code Online (Sandbox Code Playgroud)
是
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
Run Code Online (Sandbox Code Playgroud)
fri*_*ppe 12
tl;dr:pkill -f firefox确实有效。
我在pkill/pgrep手册页中找到了这个:
用于匹配的进程名称限制为 /proc/pid/stat 输出中存在的 15 个字符。使用 -f 选项来匹配完整的命令行 /proc/pid/cmdline。
在我的机器上进行本地测试时,由于/usr/lib/firefox/firefox有 PID 691953,我在 中发现了以下内容/proc/691953/stat:
691953 (GeckoMain) .... # truncated by me
Run Code Online (Sandbox Code Playgroud)
pkill GeckoMain按照承诺杀死了火狐。killall GeckoMain也有效。
最简单的解决方法可能是提供-f标志来pkill匹配/proc/<pid>/cmdline,在我的例子中包含/usr/lib/firefox/firefox。
| 归档时间: |
|
| 查看次数: |
29422 次 |
| 最近记录: |