In UNIX and Linux Operating System, Zombie processes also known as defunct processes, are those which are still running after the complete execution of the process but it still remains in the process table. In this tutorial, we will learn how to check and kill Zombie processes in CentOS 8.

How to find zombie/defunct processes in CentOS

To view Zombie or Defunct processes open up the terminal and use the following command:

# ps aux | grep “defunct”

Find defunct process

Process list

How many Zombie Processes are running?

To view how many Zombie processes are running, you can use the following commands.

# ps aux | awk {'print $8'}|grep -c Z
# ps aux | awk '{ print $8 " " $2 }' | grep -wc Z
# ps aux | awk {'print $8'}|grep Z|wc -l

List the Process ID of Zombie Process

To list down the process ID of the Zombie processes, use the following command:

# ps aux | awk '{ print $8 " " $2 }' | grep -w Z

To kill the Zombie process use the following command with the process id, it will remove the Zombie process running on your server. For this use the following command.

# kill -9 <PID>

Conclusion

In this tutorial, we learned how to display the Zombie process and their process IDs and how to kill them.

How to find and kill Zombie Processes in CentOS 8
Avatar

Karim Buzdar

About the Author: Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various web sites. You can reach Karim on LinkedIn