cancel
Showing results for 
Search instead for 
Did you mean: 

find user process

ust3
Regular Advisor

find user process

I want to kill all process for a particular user , I know I can use ps -ef to find the pid , but I found that it only find the pid , if I want to kill all process of a particular user by one time , is there any kill command can do that ? thx
8 REPLIES
Jeeshan
Honored Contributor

Re: find user process

use this command

ps -ef | awk '{print $1" "$2}' | grep | awk '{print $NF}' | xargs kill


It will kill a users all processes at a glance.

be careful. Before running this please check first if the processes are significant.
a warrior never quits
Stuart Browne
Honored Contributor

Re: find user process

'ps -u' is your friend.

ps -u | awk '{system("kill -TERM " $1)}'
One long-haired git at your service...
T G Manikandan
Honored Contributor

Re: find user process

ps -u root|awk '{print "kill -9 " $1}' | sh
Mike Stroyan
Honored Contributor

Re: find user process

You can use
pkill -u username
or
pkill -u username -s signalname
Stuart Browne
Honored Contributor

Re: find user process

Whee yay! Command I've not seen/used before! :))
One long-haired git at your service...
Srimalik
Valued Contributor

Re: find user process

I have pkill in my linux and solaris boxes but not in HPUX
abandon all hope, ye who enter here..
ust3
Regular Advisor

Re: find user process

thx reply ,

I have pkill in my box, I use pkill command before , it is good to kill the deamon , for example if I want to kill all httpd process , it can kill all httpd process by one time ( pkill httpd ), but is it suitable to use for killing the user process ? because the user process involves the init process ( the ppid is 1 ) , if use pkill , I am afraid it will kill other process that generate from other user . Thx for advise.
Mike Stroyan
Honored Contributor

Re: find user process

"pkill -u username" will only kill processes that have effective user id "username". I don't understand your concern about parent processes.