How to Locate and Eliminate Zombie Processes with ps and grep
This guide explains how to use the ps and grep commands to identify zombie processes on Linux, interpret the output fields, and terminate them safely by sending signals to the appropriate parent or child processes, with example commands and verification steps.
Finding Zombie Processes with ps and grep
ps -A -ostat,ppid,pid,cmd | grep -e '^[Zz]'Command explanation:
A : lists all processes.
-o : custom output fields.
We display stat (status), ppid (parent PID), pid (process ID), and cmd (command). Processes whose stat is Z or z are zombie processes, so we filter with grep.
Sample output: Z 12334 12339 /path/cmd To terminate the zombie, send a hang‑up signal to its parent process: kill -HUP 12339 Run the original ps command again to verify the zombie is gone. If the child cannot be killed, terminate the parent process instead:
kill -HUP 12334Using top to Observe Dynamic Process Table
In the top display, 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.
Open Source Linux
Focused on sharing Linux/Unix content, covering fundamentals, system development, network programming, automation/operations, cloud computing, and related professional knowledge.
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.
