The following command will list all users belonging to <your_group_name>
, but only those managed by /etc/group
database, not LDAP, NIS, etc. It also works for secondary groups only, it won't list users who have that group set as primary since the primary group is stored as GID
(numeric group ID) in the file /etc/passwd
.
awk -F: '/^groupname/ {print $4;}' /etc/group