Operations 3 min read

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.

Programmer DD
Programmer DD
Programmer DD
How to Detect and Eliminate Zombie Processes with ps and grep

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 .

top output showing zombie process
top output showing zombie process
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

process managementLinuxGreppskillzombie process
Programmer DD
Written by

Programmer DD

A tinkering programmer and author of "Spring Cloud Microservices in Action"

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.