Skip to content

How to kill a zombie process in Linux?

On Unix and Unix-like computer operating systems, a zombie process or defunct process is a process that has completed execution (via the exit system call) but still has an entry in the process table: it is a process in the ‘Terminated state’. In short, a process which has finished the execution but still has entry in the process table to report to its parent process is known as a zombie process.

To clean up a zombie process, it must be waited on by its parent, so killing the parent should work to eliminate the zombie.  To clear zombie process from the process table, use the following command.

kill -9 $(ps -A -ostat,ppid | grep -e '[zZ]'| awk '{ print $2 }')

Another way is to get the parent’s PID and kill it.

ps aux | grep -w Z   # Returns the zombie's pid
ps o ppid {the pid from previous command}   #Returns the parent's PID
kill -1 {the parent id from previous command}
See also  Remove a user and group in linux (Centos / Ubuntu)

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.