将启动命令中包含某个字符串的进行杀死

来源:互联网 发布:辽宁网络广播电视台 编辑:程序博客网 时间:2024/04/30 05:20
[root@dn01 testbash]# ps -ef | grep helloroot     24794  7457  0 11:09 pts/2    00:00:00 sh hello.shroot     24910  7457  0 11:09 pts/2    00:00:00 sh hello.shroot     25295  7457  0 11:11 pts/2    00:00:00 grep hello

使用

ps aux | grep hello | grep -v grep |awk '{print $2}'| xargs kill -9

可以将上述的前两个进程杀死

0 0
原创粉丝点击