Linux 常用命令十四 killall和pkill

Posted 魂~

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Linux 常用命令十四 killall和pkill相关的知识,希望对你有一定的参考价值。

用killall杀死所有同名的进程。

[email protected]:~/workpalce/git$ ps -aux | grep vim
wang      6548  0.3  0.3  17116  7520 pts/18   S+   15:55   0:00 vim a
wang      6549  0.5  0.3  17116  7440 pts/4    S+   15:55   0:00 vim b
wang      6551  0.0  0.0   6860   844 pts/1    S+   15:55   0:00 grep --color=auto vim
[email protected]:~/workpalce/git$ killall -15 vim
[email protected]:~/workpalce/git$ ps -aux | grep vim
wang      6554  0.0  0.0   6860   884 pts/1    S+   15:55   0:00 grep --color=auto vim

用pkill杀死所有同名的进程。

[email protected]:~/workpalce/git$ ps -aux | grep vim
wang      6557  0.5  0.3  17168  7596 pts/18   S+   15:56   0:00 vim thtest.py
wang      6558  1.0  0.3  17116  7588 pts/4    S+   15:56   0:00 vim b
wang      6560  0.0  0.0   6860   836 pts/1    R+   15:56   0:00 grep --color=auto vim
[email protected]:~/workpalce/git$ pkill -15 vim
[email protected]:~/workpalce/git$ ps -aux | grep vim
wang      6563  0.0  0.0   6860   796 pts/1    S+   15:56   0:00 grep --color=auto vim

 

以上是关于Linux 常用命令十四 killall和pkill的主要内容,如果未能解决你的问题,请参考以下文章

Linux--命令大全/常用命令--管理类--内存/磁盘/进程--top/free/du/df/ps/pstree/kill/killall

怎么样结束关闭linux/ubuntu系统中的进程

常用Linux Shell命令,了解一下!

Linux 系统基础优化和常用命令

2023-04-03 Linux中杀死进程kill和killall命令的区别,着重介绍killall

Linux基本命令之pidof和kill/killall