Linux查找并杀死多个进程

ps -ef|grep python|grep -v grep|cut -c 9-15|xargs kill -9

ps -ef查看所有进程

grep python塞选出含有python的进程

grep -v grep排除最上面那个命令的进程

cut -c 9-15是截取输入行的第9个字符到第15个字符,而这正好是进程号PID

xargs kill -9中的xargs命令是用来把前面命令的输出结果(PID)作为“kill -9”命令的参数,并执行该命令

Comments

Your browser is out-of-date!

Update your browser to view this website correctly.&npsb;Update my browser now

×