Gemini on Question 13, Sep 29
How do I kill a zombie process in Linux that won't respond to SIGTERM?You actually cannot kill a zombie process directly, which is exactly why it is not responding to SIGTERM (or even SIGKILL).
To understand why, you have to know what a zombie process is: A zombie is a process that is already dead.
It has finished executing and has released all its memory and CPU resources. The only reason it still shows up in your process list (usually marked with a Z or <defunct>) is because its parent process has not yet read its exit status. It is just a lingering entry in the system's process table waiting to be "reaped."
To get rid of a zombie, you must target its parent process. Here is exactly how to do it.
Step 1: Find the Parent Process ID (PPID)
First, you need to find out which process spawned the zombie. Run the following command, replacing <ZOMBIE_PID> with the ID of your zombie process:
ps -o pid,ppid,state,cmd -p <ZOMBIE_PID>
If you don't know the zombie's PID, you can list all zombies and their parents using: ps -eo pid,ppid,state,cmd | awk '$3=="Z"'
Look at the output. The second column is the PPID (Parent Process ID).
Step 2: Ask the parent to reap the child (The Gentle Approach)
Sometimes, the parent process just got stuck or temporarily forgot to reap its children. You can send a SIGCHLD signal to the parent, which essentially taps it on the shoulder and says, "Hey, your child died, clean it up."
kill -s SIGCHLD <PPID>
Wait a few seconds and check if the zombie is gone. If the parent process is poorly written or completely frozen, this will not work, and you must move to Step 3.
Step 3: Kill the Parent Process (The Guaranteed Approach)
If the parent refuses to reap the zombie, you must kill the parent process.
⚠️ WARNING: Before doing this, check what the parent process is. If the parent is a critical service (like a database or a web server), killing it will take down that service!
If it is safe to do so, kill the parent process:
kill -15 <PPID>
If the parent also refuses to die, force-kill it:
kill -9 <PPID>
What happens next?
When you kill the parent process, the zombie process becomes an "orphan." Linux handles orphans by automatically assigning them to init or systemd (PID 1).
PID 1 is specifically programmed to act as the "grim reaper" of the operating system. As soon as PID 1 adopts the zombie, it will instantly read its exit status, and the zombie will disappear from your process table.
Note: What if the Parent IS PID 1?
If the parent of the zombie is already PID 1, and the zombie is still there, there is a bug in the kernel or a very deep system hang. The only way to clear a zombie whose parent is PID 1 is to reboot the system.
(However, remember that a few zombie processes do absolutely no harm. They use zero RAM and zero CPU. The only time they are a problem is if a bug is creating thousands of them, which can exhaust the system's maximum allowed Process IDs).
Exact recordShowHideThe model id, the run, the verbatim text with line numbers and its full sha256
- Scored
- answered
- Received
- 2026-09-29 09:05:28 UTC
- Run
- 20260929T090007Z-334891
- Served by
- Google · HTTP 200 · finish stop
- Size
- 2,997 characters · 1,733 tokens out incl. hidden reasoning · 15.3 s
End of response · 50 lines · 2,997 characters · sha256 69a7269a80e98f9a5c69038f3b909c786ace24a2ca110ef74e6d7f42e0228d51