Unix Tip #4579- September 24, 2013


SEARCH : Home : Help : Today's Tip

KILLING ALL USER PROCESSES


The common method for killing all of a users processes
usually involves grepping the users name from 'ps', then
using awk to get the process id's and submitting them
to 'kill -9'.

Sys V
ex: kill -9 $(ps -fuusername | awk '{ print $2 }' )

BSDish
ex: kill -9 $(ps -aux |grep username | awk '{ print $2 }' )

The problems with doing this way are that it is slow, and
more importantly, it doesn't always kill all of the processes
on the first try.

There is a way to do this that always kills all of the users
processes the first time, and is very fast:

su - username -c 'kill -9 -1'


This tip generously supported by: jkstill@teleport.com

NOTE: All tips provided are USE AT YOUR OWN RISK. Tips are submitted by various unix admins around the globe. UGU suggest you read and test each tip in a non-volitile environment before placing into production.


LAST 5 TIPS
4578 - NFS HANG FIX ON HP-UX
4577 - REGEXP MATCHING IN AWK
4576 - Public Relations
4575 - CLEANUP AT LOGOUT
4574 - SPEED UP INTERACTION TIME


I want to SUBSCRIBE and get a UGU Tip everyday.
I want to UNSUBSCRIBE and NOT get a UGU Tip everyday.

If you have a UNIX TIP let us know, we just may use it:
(All tips become the property of the Unix Guru Universe)
Email Address:

Yes, email me a Hot Unix Tip everday.

Enter Hot Unix Tip (optional):

Yes, I will support this tip

Captcha (not case sensitive):


Please enter the above letters:


HOME | Flavors | Admin | Network | Security | S/W | Help | Events | Vendors | Careers | Internet
About | Add Link | Feedback | Search

Copyright © 1994-2005 Unix Guru Universe