[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: user processes shell scripts



On Sun, 2004-02-22 at 11:53, nico dreher wrote:

> I am looking for commands that show information about the user, that
> identify the user, 
...
> # show processes running under a certain user
> 
> ps -aux | grep USERNAME

That should be "ps aux" above. The other way
only works as long as you don't create a user
named 'x'. Try it.

Here's a good one. At your bash prompt or in
your startup files (.bashrc or .bash_login)
type the following line to define a funtion
named psu:

psu () { ps -Fu $1 -U $@ ; }

When run as "psu USERNAME -H -L" it will do this:

ps -Fu USERNAME -U USERNAME -H -L

(take the 'F' out of the function definition if
you don't want the extra-full format)

Lastly, to really see EVERY process having anything
to do with the user, try this:

ps -eo ruser,euser,suser,fuser,pid,comm,args | egrep '^RU|USERNAME[ ].*[0-9]'

That gets you the real user, effective user,
saved user, and filesystem user.




Reply to: