[CentOS] Shell script to list group members

Tim Alberts talberts at msiscales.com
Tue Sep 23 23:11:42 UTC 2008


Barry Brimer wrote:
> With spaces separating groups:
>
> egrep -e '^groupname:' /etc/group | awk -F : '{ print $4 }' | sed -e 's/,/ /g'
>
> With commas separating groups:
>
> egrep -e '^groupname:' /etc/group | awk -F : '{ print $4 }'

I'm sorry, I didn't specify, I'm using LDAP for user/group management.  
Ideally a command like 'groups' would be nice, except it would be the 
inverse, it would print the users in a group, not the groups a user 
belongs to.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: talberts.vcf
Type: text/x-vcard
Size: 337 bytes
Desc: not available
URL: <http://lists.centos.org/pipermail/centos/attachments/20080923/56d19211/attachment.vcf>


More information about the CentOS mailing list