|
|
|
|
UGU: Unix Guru Universe - Unix Tip #4151- June 23, 2012
- Home : Help
: Today's Tip
Unix Tip #4151- June 23, 2012
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
4150
- NFS HANG FIX ON HP-UX
4149
- REGEXP MATCHING IN AWK
4148
- Public Relations
4147
- CLEANUP AT LOGOUT
4146
- 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)
|
|
|
Copyright 1994-2024 Unix Guru Universe |
|
|
|
|