Linux Users – Find Out Which Users Are in a Group

groupusers

I've recently been creating new users and assigning them to certain groups. I was wondering if there is a command that shows all the users assigned to a certain group?
I have tried using the 'groups' command however whenever I use this it says 'groups: not found'

Best Answer

You can use grep:

grep '^group_name_here:' /etc/group

This only lists supplementary group memberships, not the user who have this group as their primary group. And it only finds local groups, not groups from a network service such as LDAP.

Related Question