You may come across a message that states, “There is 1 zombie process.”.
You might come across this when logging into your Ubuntu Server via SSH. If you see such a message you don’t have to panic or worry, it is just notifying you. I will explain in depth what this means.
On Linux and Unix based operating systems, a zombie is a process that has completed execution but still has an entry in the process table, allowing the process that started it to read its exit status. In simple words, the child process has died but has not yet been reaped.
When a process ends, all the memory and resources associated with it are deallocated so they can be used by other processes. However, the process’s entry in the process table remains. The parent is sent a SIGCHLD signal indicating that a child has died; the handler for this signal will typically execute the wait system call, which reads the exit status and removes the zombie.
It can be useful in some situations, for example if the parent creates another child process it will make sure that it will not be allocated the same process ID. If a zombie process is stopped or killed, the process ID can be reused. However, if a parent ignores the SIGCHLD, the zombie will be left in the process table.
Finding the zombie processes.
To find the process enter the command below. This command will print the zombie process and display its process ID.
ps axo stat,ppid,pid,comm | grep -w defunct
To kill it, enter the command below, and replace the <ID> with the process ID displayed in your Terminal.
sudo kill -9 <ID>
That’s it folks, now you have killed a zombie 🙁
Thank you for reading.