ps -A -o stat,ppid,pid,cmd | grep -e '^[Zz]' | awk '{print $2}' | xargs kill -9
Positioning zombie process and the parent process of the zombie
ps -A -ostat,ppid,pid,cmd |grep -e '^[Zz]'
Use Kill -HUP zombie process ID to kill the zombie process, this situation is often unable to kill zombies, then you need to kill the parent process zombie
kill -HUP zombie process parent ID
and then use the above statement to query the zombie process whether been killed
ps -A -ostat,ppid,pid,cmd |grep -e '^[Zz]'
Parameter Interpretation
-A parameter lists all the processes
-o custom output field stat (state), PPID (parent process id), pid (process id), cmd (command)
because the state is z or Z is a zombie process, so we use grep crawl stat state zZ process