How do I list all members of a group in Linux (and possibly other unices)?
getent group groupname | awk -F: '{print $4}' | tr , '\n'
This has 3 parts:
1 - getent group groupname shows the line of the group in "/etc/group" file. Alternative to cat /etc/group | grep groupname.
2 - awk print's only the members in a single line separeted with ',' .
3 - tr replace's ',' with a new line and print each user in a row.
4 - Optional: You can also use another pipe with sort, if the users are too many.
Regards