Last night I used the following to kill a user's processes:

ps aux | grep username | awk '{print $2}' | xargs kill

ps aux - get the process list
grep username - get lines from the list that contain the username
                (potential problem here if the username has similarities
                 to a unix command or directory of program, i.e. 'ash'
                 & 'bash', use 'awk' here if such a problem might exist)
awk '{print $2}' - get the PID's
xargs kill - kill the PID's

It seemed to work fine, though I certainly want to know if I overlooked
something, or there's a better way.

                             - Martin J. Brown, Jr. -
                             - [EMAIL PROTECTED] -


On Wed, 12 Jul 2000, Anthony E. Greene wrote:

> At 21:10 2000-07-11 -0700, Steven Pierce wrote:
> >I am a newbie so please bare with me for some simple ( to most) questions.
> >I have a Linux server and I logged in last night three times.  I was
> checking some
> >of the log in's that I set up.  After I was done, I had closed the screen
> that I was
> >using.  Forgetting to log off as those users.  
> >
> >Later on I found out what I had done.  It was not an issue because I know
> it was 
> >me that was there.  My question is if I am looking at TOP and I see that 
> >there is users on my machine that do not belong there, how can I get 
> >them off?? 
> 
> ps aux | grep username
> 
> Take note of the PID (process ID) of the bash shell the user is running,
> then as root:
> 
> kill PID
> 


-- 
To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe"
as the Subject.

Reply via email to