如何查看Linux系统上的僵尸进程,如何统计有多少僵尸进程?
#ps -ef | grep defunct
或者查找状态为Z的进程,Z就是代表zombie process,僵尸进程的意思。
另外使用top命令查看时有一栏为S,如果状态为Z说明它就是僵尸进程。
Tasks: 95 total, 1 running, 94 sleeping, 0 stopped, 1617 zombie
top命令中也统计了僵尸进程。或者使用下面的命令:
ps -ef | grep defunct | grep -v grep | wc -l
如何杀死僵尸进程呢?
一般僵尸进程很难直接kill掉,不过您可以kill僵尸爸爸。父进程死后,僵尸进程成为”孤儿进程”,过继给1号进程init,init始终会负责清理僵尸进程.它产生的所有僵尸进程也跟着消失。
ps -e -o ppid,stat | grep Z | cut -d” ” -f2 | xargs kill -9
Linux之僵尸进程 http://www.linuxidc.com/Linux/2014-04/99291.htm
Ubuntu查找和杀死僵尸进程 http://www.linuxidc.com/Linux/2013-11/93169.htm
Linux 系统中僵尸进程 http://www.linuxidc.com/Linux/2013-10/91567.htm
Linux 的僵尸(zombie)进程 http://www.linuxidc.com/Linux/2013-06/86128.htm
Linux下僵尸进程的处理 http://www.linuxidc.com/Linux/2012-08/67219.htm
本文永久更新链接地址:http://www.linuxidc.com/Linux/2015-02/114112.htm