1849261 Members
6340 Online
104042 Solutions
New Discussion

ps -g grplist

 
SOLVED
Go to solution
Etienne Roseau
Frequent Advisor

ps -g grplist

hi everybody !
i am unable to find the right way to run a ps !!
i am trying to list every processes from a specific group of users, doing ps -g grplist
where i put:
1/gid for grplist (no error but no processes : impossible)
2/$groupname for grplist (error : "ps: wrong group leader PID number $groupname")
do i understand well the "grplist" ?
or am i unable to read man pages (glasses maybe !) ?
THX
E.
5 REPLIES 5
Ralph Grothe
Honored Contributor
Solution

Re: ps -g grplist

Try

UNIX95= ps -G
Madness, thy name is system administration
Simon Hargrave
Honored Contributor

Re: ps -g grplist

You need the PRG4 version of ps to do this.

Try:

UNIX95= ps -G 102,105

This will show all processes for users who's real GID is 102 or 105.
Simon Hargrave
Honored Contributor

Re: ps -g grplist

(to avoid confusion that should be XPG4 not PRG4 - can't type this morning!)
Etienne Roseau
Frequent Advisor

Re: ps -g grplist

that's resolving my problem, thanks you 2 !!
but i still don't understand my "ps -g grplist" problem, any idea ??
Ralph Grothe
Honored Contributor

Re: ps -g grplist

Unix organizes processes in process groups.
This is quite handy if you need to send signals to a whole group of dependant process.
Instead of signaling each process (that you would have to look up in the process table)
you just send a signal to the process leader.
The login shell you use is a typical example.
When you exit a SIGHUP is sent to all its children.
Or consider the following.
I logged using SSH as transport.

$ UNIX95= ps -fC sshd
UID PID PPID C STIME TTY TIME CMD
root 856 1 0 Jul 8 ? 00:00 /opt/ssh/sbin/sshd
root 13137 856 0 09:45:55 ? 00:00 sshd: saz [priv]

The connection accepting parent 856 forked off my sshd with 13137 being the group leader.

$ ps -fg 13137
UID PID PPID C STIME TTY TIME COMMAND
root 13137 856 0 09:45:55 ? 0:00 sshd: saz [priv]
saz 13139 13137 0 09:45:56 ? 0:00 sshd: saz@pts/1


I have to admid the notion of groups is a bit ambiguous, and maybe I as well have misunderstood it and someone more knwoledgeable will correct me soon ;-)
Madness, thy name is system administration