LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux > Linux - General
User Name
Password
Linux - General This 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
 
Thread Tools
Old 11-06-2009, 12:30 AM   #1
balakrishnay
LQ Newbie
 
Registered: Sep 2009
Posts: 3
Thanked: 0
To kill all processes except mine


[Log in to get rid of this advertisement]
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
windows_xp_2003 balakrishnay is offline     Reply With Quote
Old 11-06-2009, 12:53 AM   #2
voyciz
Member
 
Registered: Mar 2004
Distribution: Slackware
Posts: 282
Thanked: 2
You could do something like this:

for process in $(ps -u USERNAME -o pid)
do
kill -9 $process
done
linux voyciz is offline     Reply With Quote
Old 11-06-2009, 11:27 AM   #3
luck.anshu
LQ Newbie
 
Registered: Jan 2009
Location: India
Posts: 10
Thanked: 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
linuxcentos luck.anshu is offline     Reply With Quote

Reply

Bookmarks


Thread Tools

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 Off
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 04:33 AM
How to kill processes using fuser? yuxingpiao Linux - Newbie 1 05-16-2008 10:18 AM
Can't kill certain processes.... Basslord1124 Slackware 2 01-29-2008 11:28 AM
how to kill processes htamayo Linux - Newbie 2 09-25-2007 11:27 AM
how to use kill to kill a batch of processes with same name? dr_zayus69 Linux - Software 2 09-03-2005 07:35 PM


All times are GMT -5. The time now is 01:12 AM.

Main Menu
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
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration