LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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 11-05-2009, 11:30 PM   #1
balakrishnay
Member
 
Registered: Sep 2009
Posts: 31

Rep: Reputation: 15
To kill all processes except mine


Hi All,

I know its repeated question but still i am not clear properly.

I wanted to kill all process of one user except mine ( i.e logged in user to kill all processes).

Normally i used to use this command to kill all processes

kill -9 -1

But this kills all process including my session.I dont want to do this .

2. How to find out all parent process and child process specific to each parent.

Regards

krishna
 
Old 11-05-2009, 11:53 PM   #2
voyciz
Member
 
Registered: Mar 2004
Distribution: Slackware
Posts: 425

Rep: Reputation: 40
You could do something like this:

for process in $(ps -u USERNAME -o pid)
do
kill -9 $process
done
 
Old 11-06-2009, 10:27 AM   #3
luck.anshu
LQ Newbie
 
Registered: Jan 2009
Location: India
Posts: 11

Rep: Reputation: 0
Quote:
Originally Posted by voyciz View Post
You could do something like this:

for process in $(ps -u USERNAME -o pid)
do
kill -9 $process
done
The following command will kill all the process ids except your user and root user:
ps au | grep -v "`whoami`\|root\|PID" | awk '{print $2}'| xargs sudo kill -9
 
  


Reply



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
Use only one "kill" to kill father and child processes Xosen Programming 7 08-28-2008 03:33 AM
How to kill processes using fuser? yuxingpiao Linux - Newbie 1 05-16-2008 09:18 AM
Can't kill certain processes.... Basslord1124 Slackware 2 01-29-2008 10:28 AM
how to kill processes htamayo Linux - Newbie 2 09-25-2007 10:27 AM
how to use kill to kill a batch of processes with same name? dr_zayus69 Linux - Software 2 09-03-2005 06:35 PM

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

All times are GMT -5. The time now is 08:10 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