Reprint: http://blog.csdn.net/shanzhizi/article/details/47320595
On linux servers, there are some zombie processes , and here's how to quickly find and destroy these zombie processes
First, we can use the top command to see if the server currently has a zombie process, in which you can see the number of zombie process hints, if the number is greater than 0, it means that the server currently exists a zombie process
Below, we use the PS and grep commands to find the zombie process
Ps-a-ostat,ppid,pid,cmd | Grep-e ' ^[zz] '
Command annotations:
-A parameter lists all processes
-O Custom output fields We set the Display field to stat (status), Ppid (process parent ID), PID (process id), cmd (command) four parameters
Because the process of Z or Z is a zombie process, we use grep to grab the stat state for the ZZ process
The operating results are as follows
Z 12334 12339/path/cmd
At this point, we can use kill-hup 12339来 to kill this zombie process .
After running, you can run Ps-a-ostat,ppid,pid,cmd | Grep-e ' ^[zz] ' to confirm whether to kill the zombie process
If the kill child process is not valid, you can try to kill its parent process to resolve the problem, such as the parent process PID is 12334, then we run
Kill-hup 12334
To solve the problem.
June 9, 2014 added add
Check current zombie Process information
Ps-ef | grep defunct | Grep-v grep | Wc-l
View top two lines of information
Top | Head-2
Direct Kill Process
Ps-ef | grep defunct | Grep-v grep | awk ' {print ' kill-18 "$ $} '
Find and kill zombie processes on Linux