有时,当我尝试启动Firefox时,显示“ Firefox进程已在运行”。因此,我必须这样做:
jeremy@jeremy-desktop:~$ ps aux | grep firefox
jeremy 7451 25.0 27.4 170536 65680 ? Sl 22:39 1:18 /usr/lib/firefox-3.0.1/firefox
jeremy 7578 0.0 0.3 3004 768 pts/0 S+ 22:44 0:00 grep firefox
jeremy@jeremy-desktop:~$ kill 7451
我想要的是一个可以为我完成所有任务的命令。它会grep
在进程列表中使用一个输入字符串并将其(或其他内容)放入其中,并杀死输出中的所有进程:
jeremy@jeremy-desktop:~$ killbyname firefox
我尝试在PHP中执行此操作,但exec('ps aux')
似乎只显示已exec()
在PHP脚本本身中执行过的进程(因此,它显示的唯一进程是其自身。)
pkill -f "Process name"
命令的答案……