linux下如何按名字杀掉该进程?


比如:

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

上面的命令是按照PID使用kill来删掉的。 如何按名字杀掉该进程? 比如 killbyname 7451?

Linux 命令 技巧

经常打瞌睡 9 years, 10 months ago

有两个命令:

pkill firefox

请参考: http://linux.about.com/library/cmd/bl...

killall firefox

killall sends a signal to all processes running any of the specified commands. If no signal name is specified, SIGTERM is sent.

Signals can be specified either by name (e.g. -HUP) or by number (e.g. -1) or by option -s.

If the command name is not regular expression (option -r) and contains a slash (/), processes executing that particular file will be selected for killing, independent of their name.

史巴拉古大师 answered 9 years, 10 months ago

Your Answer