ps -ef | grep firefox | grep -v grep | awk ‘{print "kill -9 "$2}‘|sh #列出了当前主机中运行的进程中包含firefox关键字的进程 ps -ef | grep firefox | grep -v grep #列出了要kill掉这些进程的命令,并将之打印在了屏幕上 ps -ef | grep firefox | grep -v grep | awk ‘{print "kill -9 "$2}‘ #后面加上|sh后,则执行这些命令,进而杀掉了这些进程 ps -ef | grep firefox | grep -v grep | awk ‘{print "kill -9 "$2}‘ | sh
ps -ef | grep firefox | grep -v grep | cut -c 9-15 | xargs kill -9 #列出了当前主机中运行的进程中包含firefox关键字的进程 ps -ef | grep firefox | grep -v grep #截取第9至15字符(进程id),列出了要kill掉这些进程的id,并将之打印在了屏幕上 ps -ef | grep firefox | grep -v grep | cut -c 9-15 #后面加上‘xargs kill -9‘后,则执行这些命令,进而杀掉了这些进程 ps -ef | grep firefox | grep -v grep | cut -c 9-15 | xargs kill -9
转载:https://www.cnblogs.com/abeen/p/11080841.html
原文:https://www.cnblogs.com/cidgur/p/12029734.html