Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

One of the ubuntu server has 82 zombie processes. All processes shows '[sh] defunct' as process command. Is there a way to find out which process is becoming a zombie process?

I tried checking the /proc/PID/ directory to get some clue about zombie process but all files are empty. How to find who let this process as zombie.. . Is there any other way to find it out?

Updated/Solved: Made the question clearer, and Answered my own question as suggested by andcoz.

share|improve this question
    
I am not sure I understand your question correctly, but ps -x will show a list of processes and their respective status (column STAT). Status Z means Zombie (and you should also see the string <defunct> in the COMMAND column). –  Ansgar Esztermann Mar 7 '12 at 13:42
2  
@user379997, do not leave the question unanswered. If you find the answer by yourself, you have to write an answer and then accept your own answer. Do not put the answer in the question! –  andcoz Mar 7 '12 at 18:02
    
you have to accept your answer, once you have posted it. –  Coren Mar 8 '12 at 12:47
    
I tried accepting but unable to ... Got message to wait for another day .. Will do on tomorrow. –  user379997 Mar 8 '12 at 13:57

3 Answers 3

Of course you can. There's many ways to do it, most common is probably :

ps aux

You can add a basic | grep -w Z and you'll have a short list of your zombies. If you only want a list of zombie process and their pids, you can do as indicated on this page :

ps aux | awk '{ print $8 " " $2 }' | grep -w Z

Check this question for more details about process information.

share|improve this answer
1  
awk can do all of that without needing to be piped to grep -- something like ps ax | awk '$3=="Z" { print $1 }'. –  Chris Down Mar 7 '12 at 13:58
    
my question was different, sorry for not making it clear... Updated it with answer. –  user379997 Mar 7 '12 at 14:28

The short answer is that you don't care. A zombie process is dead. All it consumes is a tiny bit of kernel memory, for that entry in the process table.

Since all that remains of the process is the process table entry, you have little to go on. A zombie process is a dead process that its parent hasn't reaped yet; look at the process's PPID to see who the parent is.

share|improve this answer
up vote 1 down vote accepted

One of the reasons for Zombie process are 'parent process' not waiting for the 'child process' - Executed ps -l which shows the parent process ID, with that you can find exactly which process is responsible for zombies in the machine.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.