Linux如何查找杀死僵死进程

找出僵死进程命令:

ps -A -o stat,ppid,pid,cmd | grep -e '^[Zz]'

 命令注解:
-A 参数列出所有进程
-o 自定义输出字段 设定显示字段为 stat(状态), ppid(进程父id), pid(进程id),cmd(命令)

PS:状态为z或者Z 的进程为僵尸进程

运行结果参考如下:

Zs   30347 30351 [sh] <defunct>
Zs   30345 30352 [sh] <defunct>
Zs   30346 30353 [sh] <defunct>
Z    30347 30354 [crond] <defunct>
Z    30346 30356 [crond] <defunct>

直接查找僵死进程,然后将父进程杀死

扫描二维码关注公众号,回复: 1188054 查看本文章

ps -A -o stat,ppid,pid,cmd | grep -e '^[Zz]' | awk '{print $2}' | xargs kill -9

猜你喜欢

转载自lijitaoccnu.iteye.com/blog/1944769
今日推荐