How to Detect and Eliminate Zombie Processes with ps and grep
This guide explains how to use the Linux ps and grep commands to identify zombie processes, interpret their status fields, and safely terminate them with kill -HUP, including steps to verify removal and alternative methods using top.
Finding Zombie Processes with ps and grep
ps -A -ostat,ppid,pid,cmd | grep -e '^[Zz]'Command explanation:
-A lists all processes.
-o customizes output fields; we display stat (status), ppid (parent PID), pid (process ID), and cmd (command). Processes with status z or Z are zombie processes.
The command returns lines such as: Z 12334 12339 /path/cmd To terminate the zombie, send a hang‑up signal to its parent process ID: kill -HUP 12339 Run the ps command again to verify the zombie is gone. If the child process cannot be killed, terminate its parent (PID 12334 in the example): kill -HUP 12334 You can also use top to view a dynamic process table, where zombie processes are marked as zombie .
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Programmer DD
A tinkering programmer and author of "Spring Cloud Microservices in Action"
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
