Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

how do I detect and kill zombie processes left from the command line of a Linux terminal?

share|improve this question

migrated from stackoverflow.com Apr 28 '11 at 16:00

This question came from our site for professional and enthusiast programmers.

1  
You can't kill the undead :P. Zombie process are dead process that are waiting to be "waited" with the parent process. In this process the parent knows how their children ended. When ever the terminal ends, this process will be inherit by init and init will "wait" them. So what you need is to kill/end the parent process. –  anizzomc Apr 28 '11 at 15:17
add comment

3 Answers 3

You cannot kill a zombie process. If the parent process does not call wait(), you have to kill the parent process to remove the zombie.

share|improve this answer
add comment

You can grep for "defunct", or check for Z in the "state" output

ps -eo state,pid,cmd | grep "^Z"

If you want to kill it as well

ps -eo state,ppid | awk '$1=="Z"{cmd="kill -9 "$2;system(cmd) }'
share|improve this answer
add comment

Try:

ps aux

and look at the status column. Zombie are represented by letter Z.

share|improve this answer
add comment

Your Answer

 
discard

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