What Is a Zombie Process and How to Kill It in Linux

You open top
on a server and see one zombie in the task summary. The same process may appear as <defunct> in a process listing. It has already finished, but its parent has yet to collect its exit status.
This guide explains why zombie processes appear, how to find their parents, and what to do if they keep accumulating.
What a Zombie Process Is
When a child process exits, the kernel releases its address space and closes its open files. The kernel keeps a small record with the child’s process ID (PID), exit status, and resource usage. The child is a zombie until its parent collects that information with wait(), waitpid(), or a similar call. Collecting the status and removing the record is called reaping.
Why Zombies Appear
Linux normally sends the parent a SIGCHLD signal when a child exits. A short-lived zombie is normal while the parent gets around to collecting the child’s status. If the same zombie remains in several process listings, the parent may be stuck or may have a bug in the code that handles child processes.
Impact on System Resources
A few zombies generally have little effect on the system. They do not run or use CPU time, and each takes up a small amount of kernel memory for its process record. A growing count is worth investigating because each zombie holds a PID and a process table slot. If the system runs out of slots, it cannot start new processes.
How to Find Zombie Processes
Use ps
to list processes and keep the rows whose state starts with Z. Include the parent process ID (PPID) so you can see which process needs to reap each zombie:
ps -eo pid,ppid,stat,comm | awk 'NR == 1 || $3 ~ /^Z/' PID PPID STAT COMMAND
4815 4790 Z workerIn this example, worker is the zombie with PID 4815, and 4790 is its parent. The leading Z in the STAT column marks the zombie. The comm field prints only the process name. If you list processes with ps aux or ps -ef, the same zombie appears as [worker] <defunct> in the COMMAND column.
How to Clear a Zombie Process
The zombie has already exited, so even kill -9 cannot remove it. If the same zombie persists, check that it still has the same parent. Use the two PIDs from your own listing in the following commands:
ps -p 4815 -o pid,ppid,stat,comm
ps -p 4790 -o pid,user,argsThe first command lets you confirm the child is still in state Z and has the same PPID. The second shows who owns the parent and how it was started. If the zombie has disappeared, it has already been reaped. If the PPID has changed, look up the new parent before taking any action.
Sending the parent another SIGCHLD with kill -s CHLD 4790 can help if the parent responds by reaping its children. The signal itself does not perform the cleanup. If the zombies keep piling up, you may need to restart the parent program.
On a systemd host, pass the parent PID to systemctl status to see which unit it belongs to:
systemctl status 4790Use the service name shown at the top of the output if the process belongs to a service you manage.
For example, if the parent belongs to queue-worker.service, restart that service:
sudo systemctl restart queue-worker.serviceIf you started the parent yourself, close it normally if you can. If it has no normal shutdown command and you have confirmed its PID, you can send it SIGTERM
with kill -s TERM 4790.
When the parent exits, Linux passes its children to the nearest ancestor set up to adopt them, called a subreaper, or to init if there is no such ancestor. The new parent can then reap the zombies. Run the original ps command again to check whether the entries have disappeared.
When the Parent Is PID 1
If the PPID is 1, skip the commands that signal or restart the parent. On the host, check the system logs for problems with the init process. Inside a container, PID 1 may be the application itself. Check the container logs and, if the zombies keep accumulating, restart the affected container when it is safe to do so.
Many applications are not written to run as PID 1. They do not reap the orphaned processes that the kernel hands to them. To avoid this, you can start the container with the --init option of docker run
, or set init: true in Compose. With this option, Docker places a minimal init program in front of your application as PID 1. That program reaps the orphans when they exit.
Conclusion
If the same parent keeps leaving zombies after a restart, check its logs and look for an application update. A restart can clear old entries, but a fix in the parent is what stops new ones from piling up.
Tags
Linuxize Weekly Newsletter
A quick weekly roundup of new tutorials, news, and tips.
About the authors

Dejan Panovski
Dejan Panovski is the founder of Linuxize, an RHCSA-certified Linux system administrator and DevOps engineer based in Skopje, Macedonia. Author of 1000+ Linux tutorials with 20+ years of experience turning complex Linux tasks into clear, reliable guides.
View author page