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

Re: How do I list all users in a group?



Hi,

> Hi, I know the question may have simple answer... but I googled to no
> avail for quite some time now.
> Is there a command to list all users that are part of a group?
> If I look into /etc/passwd I can see some informations, but not all
> and not easy to reconstruct.
> Thank you all for any advice,

I'd do this:

group="group-name"
grep "^${group}:" /etc/group | awk -F ':' '{print $4}'

It produces a comma separated list of users

-- 
Cédric Lucantis



Reply to: