Linux/Unix – How to Kill All the Processes Belonging to a User

If you want to kill all the processes that belong to a user, run any of these commands:

ü  kill `ps -u <username> -o “pid=”`

ü  ps -U username | awk ‘{print $2}’ | xargs kill -9

ü  ps -ef | awk ‘/username/{print “kill -9 “$2}’|sh

 

If the kill doesn’t respond and you need to force it, run:

 kill -9 `ps -u <username> -o “pid=”`

Advertisements

About msotela

This blog is for anyone who wants to access the power of a Linux system as a systems administrator or user. You may be a Linux enthusiast, a Linux professional, or possibly a computer professional who is increasingly finding the Windows systems in your data center supplanted by Linux boxes.

Posted on March 16, 2009, in Unix/Linux. Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: