
1、查看系统是否有僵尸进程
使用Top命令查找,当zombie前的数量不为0时,即系统内存在相应数量的僵尸进程。

2、定位僵尸进程
使用命令ps -A -ostat,ppid,pid,cmd |grep -e '^[Zz]'定位僵尸进程以及该僵尸进程的父进程。
3、杀死僵尸进程
使用Kill -HUP 僵尸进程ID来杀死僵尸进程,往往此种情况无法杀死僵尸进程,此时就需要杀死僵尸进程的父进程。
kill -HUP 僵尸进程父ID
然后使用上面第二步的语句查询该僵尸进程是否被杀死。
4、参数解读
ps -A -ostat,ppid,pid,cmd |grep -e '^[Zz]'
-A 参数列出所有进程
-o 自定义输出字段 stat(状态)、ppid(进程父id)、pid(进程id)、cmd(命令)
因为状态为z或者Z的进程为僵尸进程,所以我们使用grep抓取stat状态为zZ进程