How to kill zombie processes

How to display and kill zombie processes


To find if zombies exist 
Use Linux Bulit-in "top" Command:

[root@amitmaheshwari.in ~]# top  | grep Tasks
Tasks: 116 total,   1 running, 115 sleeping,   0 stopped,   0 zombie
Tasks: 116 total,   2 running, 114 sleeping,   0 stopped,   0 zombie
Tasks: 116 total,   1 running, 115 sleeping,   0 stopped,   0 zombie
Tasks: 116 total,   1 running, 115 sleeping,   0 stopped,   1 zombie

Check zombie Process by "ps" command:
[root@amitmaheshwari.in ~]# ps aux | awk '{ print $8 " " $2 }' | grep -w Z
example output: Z+ 7872

Kill the zombies
zombies are living dead, so the aren't always easy to kill.

Try executing: kill -9 PID
example: kill -9 7872
Hopefully it will work, else below command will check PPID (Parent Process ID and Kill it)

If you need a  single line command that does the work you can try :
kill -HUP `ps -A -ostat,ppid | grep -e '^[Zz]' | awk '{print $2}'`

Great !!  It works perfectly

What is Zombie Process ?