LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-04-2011, 04:01 AM   #1
mahmoodn
Member
 
Registered: May 2010
Posts: 427

Rep: Reputation: 16
find and kill all zombie processes


I want to find all zombie processes and kill them. from http://www.cyberciti.biz/tips/killin...e-process.html I know that
Code:
ps aux | awk '{ print $8 " " $2 }' | grep -w Z
will find the zombie processes but it will show like
Code:
Z 4104
. How can I kill all of them?
 
Old 08-04-2011, 04:09 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,119

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Why don't you read the complete article ?.
 
Old 08-04-2011, 04:19 AM   #3
kirukan
Senior Member
 
Registered: Jun 2008
Location: Eelam
Distribution: Redhat, Solaris, Suse
Posts: 1,278

Rep: Reputation: 148Reputation: 148
Quote:
print $8 " " $2
From "ps aux" output $8, $2 print 8th and 2nd fields
 
Old 08-04-2011, 04:26 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
...in addition to post #1: killing zombies is fighting symptoms not addressing the cause, which is what you should do.
 
Old 08-04-2011, 04:36 AM   #5
mahmoodn
Member
 
Registered: May 2010
Posts: 427

Original Poster
Rep: Reputation: 16
I tried this
Code:
ps aux | awk '{ print $8 " " $2 }' | grep -w Z | awk '{ print $2 }' | xargs -0 sudo  kill -9
That will first print
"Z 11022"
and then
"11022"
Then I used xargs to pass a command to each output. Is this correct?
Code:
xargs -0 sudo  kill -9
However I get this output:
Code:
...
11022
".
Usage:
  kill pid ...              Send SIGTERM to every process listed.
  kill signal pid ...       Send a signal to every process listed.
  kill -s signal pid ...    Send a signal to every process listed.
  kill -l                   List all signal names.
  kill -L                   List all signal names in a nice table.
  kill -l signal            Convert between signal numbers and names.
 
Old 08-31-2011, 02:32 AM   #6
wladimirec
LQ Newbie
 
Registered: Mar 2011
Posts: 1

Rep: Reputation: 1
I've got the same problem and found handy info here:
LinuxQuestions.org > Forums > Linux Forums > Linux - General : [SOLVED] Cleaning up this kill command
http://www.linuxquestions.org/questi...ommand-892571/

it should looks like:
Code:
for pid in $(ps aux | awk '{ print $8 " " $2 }' | grep -w Z | awk '{ print $2 }'); do kill -9 $pid; done;

Last edited by wladimirec; 08-31-2011 at 02:34 AM.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to kill zombie processes gikpo4 Programming 1 12-03-2010 05:11 PM
how to find abandoned processes, and kill them all? jimmyjiang Red Hat 13 06-17-2008 12:10 PM
Zombie processes Ynot Irucrem General 2 01-11-2007 12:23 AM
Wine zombie processes completely kill sound Haiyadragon Linux - Software 4 01-01-2006 03:44 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:53 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration