系统相关
首页 > 系统相关> > Linux按名字杀死进程

Linux按名字杀死进程

作者:互联网

* 下面的<proc-name>是进程名,使用时要替换成具体的进程名

 

方法1:

kill -9 $(pidof <proc-name>) 精确匹配杀死进程
kill -9 $(pgrep <proc-name>) 模糊匹配杀死进程

 

方法2:

其实是方法1的组合(缩略)写法:

kill -9 $(pidof <proc-name>) 精确匹配杀死进程
kill -9 $(pgrep <proc-name>) 模糊匹配杀死进程

 

方法3:

ps -ef|grep <proc-name>|grep -v grep|awk '{print $2}'|xargs kill -9 

 

标签:grep,匹配,kill,pgrep,Linux,进程,杀死
来源: https://www.cnblogs.com/live41/p/15580022.html