Gemini on Question 13, Sep 15
How do I kill a zombie process in Linux that won't respond to SIGTERM?The short answer is: You cannot kill a zombie process because it is already dead.
This is why it won't respond to SIGTERM (or even SIGKILL / kill -9).
A "zombie" (defunct) process is simply an entry in the process table. The process itself has already finished executing and released its memory. It is just waiting for its parent process to acknowledge its death (by reading its exit status). If the parent process is poorly programmed or frozen, it never acknowledges the child's death, leaving the zombie in the process table.
To get rid of a zombie, you don't kill the zombie—you kill the parent process.
Here is the step-by-step guide to removing it:
Step 1: Confirm it is actually a zombie
First, make sure it is a zombie (State Z) and not a process stuck in uninterruptible sleep (State D). Run:
ps aux | awk '{ print $8 " " $2 }' | grep -w ZIf you see your Process ID (PID) listed next to a Z, it is a zombie. If it has a D instead, see the note at the bottom of this answer.
Step 2: Find the Parent Process ID (PPID)
You need to find out which process spawned the zombie. Run this command, replacing <zombie_pid> with the ID of your zombie process:
ps -o ppid= -p <zombie_pid>
This will output a single number. That number is the Parent Process ID (PPID).
(Alternatively, you can use pstree -p -s <zombie_pid> to see a visual tree of the process).
Step 3: Nudge the Parent Process
Before killing the parent, you can try sending it a SIGCHLD signal. This signal tells the parent, "Hey, one of your children died, you need to clean it up."
kill -s SIGCHLD <ppid>
Note: This rarely works because if the parent was going to respond to this signal, it wouldn't have created a zombie in the first place. But it is harmless to try.
Step 4: Kill the Parent Process
If step 3 doesn't work, you must kill the parent process.
Warning: Make sure you know what the parent process is before you kill it! If the parent is a vital service (like nginx or mysql), killing it will stop that service. You can check what the parent is by running ps -p <ppid>.
If you are okay with killing the parent, run:
kill -15 <ppid>
If the parent also refuses to die, force kill it:
kill -9 <ppid>
What happens next?
When the parent dies, the zombie process becomes an "orphan." The Linux kernel automatically assigns all orphans to the init or systemd process (PID 1). PID 1 is explicitly programmed to immediately clean up and clear out zombie processes. The zombie will instantly disappear.
Exception: What if the Parent is PID 1?
If you check the PPID in Step 2 and the number is 1, you cannot kill the parent (killing PID 1 will crash your system). At this point, the only way to clear the zombie from the process table is to reboot the machine. Fortunately, zombies use absolutely zero system resources (CPU/RAM); they just take up one slot in the process ID table, so it is perfectly safe to just ignore them until your next scheduled reboot.
A Common Mix-Up: State "D" (Uninterruptible Sleep)
Often, people have a process that is frozen, refusing to die via kill -9, and they assume it is a zombie. If you check the process state in top or ps and it has a D instead of a Z, it is not a zombie.
State D means the process is stuck waiting for hardware I/O (usually a failing hard drive, or a disconnected NFS network drive). To fix a D state process, you must fix the hardware/network issue it is waiting on, or reboot the server. You cannot kill it.
Exact recordShowHideThe model id, the run, the verbatim text with line numbers and its full sha256
- Scored
- answered
- Received
- 2026-09-15 09:06:01 UTC
- Run
- 20260915T090004Z-599f39
- Served by
- Google · HTTP 200 · finish stop
- Size
- 3,633 characters · 2,022 tokens out incl. hidden reasoning · 17.1 s
End of response · 61 lines · 3,633 characters · sha256 a2c45b65997941cbc39ecc08ef0cb13cd83c20c73a8090820b2aeb8303a58d25