Sunday, 16 June 2019

Kill all Zombie processes

It can be a case when there are too many zombie processes on the system, and there are no sufficient resources available to spawn more processes. Let's see how to deal with such a situation:

How to check zombie processes?

top, a command line utility (which comes by default with most of the Linux distributions) can tell about the zombie processes.
top

It will provide output like below:

    How to get the PID of a zombie process?

    There are multiple ways to check PID of a Zombie process, here we are using ps command (in-built command in most of the Linux distributions)


    ps axo stat,ppid,pid,comm | grep -w defunct
    

    Above command will provide all the pid's (Process IDs) and ppid (Parent Process ID's) of all zombie processes.

    Kill all Zombie Processes

    To kill the zombie process, we have to tell the respective parent process to rip its child process as below.

    kill -CHLD <PPID>
    

    For the above ex:

    kill -CHLD 17807
    

    And you are done!

    0 comments:

    Post a Comment

     

    Copyright @ 2013 Appychip.

    Designed by Appychip & YouTube Channel