How to find and kill zombie process ?

If you already knows whats zombie process and wanted to identify all zombie process’s in you system, you can directly proceed ahead but if you don’t know, we may suggest you first read the article, “What is Zombie process and How to create zombie process in Linux ?”

Lets consider, now you have created the zombie process purposefully, and want to identify what are its details, type below command,

 $ ps -aux | grep defunct 

This will give you all existing zombie process in your system ( which will also include our purposefully created “our_zombie_child” ) as,

$ ps -aux | grep defunct
root 1303 0.0 0.0 0 0 ? ZN 14:01 0:00 [bandwidthd] myuser 4496 0.0 0.0 0 0 pts/3 Z+ 14:37 0:00 [our_zombie_chil] 

Now, you can also check what is the parent process of this child as, [ Note: 4496 is pid of child ]

$ pstree -p -s 4496
systemd(1)───lightdm(1235)───lightdm(1742)───upstart(1978)───gnome-terminal-(4423)───bash(4430)───our_zombie_chil(+

This will give the complete process tree of the defunct child.

Now, if you want to kill the zombie process, we can use the “kill” command along with its pid as,

 kill -9 4496 
READ  How Android Bluetooth Profiles are enabled & Services activated ?

Leave a Reply

Your email address will not be published. Required fields are marked *