Linux 批量杀进程的命令
执行如下命令进行批量查杀:
ps -ef | grep ssh | grep -v grep | awk '{print "kill -9 "$2}'|sh
分析:
#列出了当前主机中运行的进程中包含firefox关键字的进程 ps -ef | grep ssh | grep -v grep #列出了要kill掉这些进程的命令,并将之打印在了屏幕上 ps -ef | grep ssh | grep -v grep | awk '{print "kill -9 "$2}' #后面加上|sh后,则执行这些命令,进而杀掉了这些进程 ps -ef | grep ssh| grep -v grep | awk '{print "kill -9 "$2}' | sh
本文来自博客园,作者:数据库小白(专注),转载请注明原文链接:https://www.cnblogs.com/xulinforDB/p/13594821.html