fratrik Asked: 2012-05-15 05:24:23 +0800 CST2012-05-15 05:24:23 +0800 CST 2012-05-15 05:24:23 +0800 CST How do I list the members of a group? 772 How can I see all the members of a group in Linux? user-management 3 Answers Voted Best Answer us3r 2012-05-15T05:47:53+08:002012-05-15T05:47:53+08:00 Use the commands: getent group groupname or getent group groupname | awk -F: '{print $4}' | tr "," " " anonymous 2015-12-11T00:53:53+08:002015-12-11T00:53:53+08:00 You can do members YOUR_GROUP_NAME and it will list all the users in the group YOUR_GROUP_NAME. If it's not installed by default: sudo apt-get install members Nikhil Katre 2016-10-05T14:18:29+08:002016-10-05T14:18:29+08:00 One more way to check all the members of a group is by checking the /etc/group file which lists all the groups and its members Example: root:x:0: daemon:x:1: bin:x:2: sys:x:3: adm:x:4:syslog,nikhil tty:x:5: disk:x:6: lp:x:7: mail:x:8: news:x:9: uucp:x:10: man:x:12: proxy:x:13: kmem:x:15: dialout:x:20: fax:x:21: voice:x:22: cdrom:x:24:nikhil floppy:x:25: tape:x:26: sudo:x:27:nikhil audio:x:29:pulse The first string (separated by :) specifies the group name and the last string specifies the user added to this group.
Use the commands:
or
You can do
and it will list all the users in the group
YOUR_GROUP_NAME
.If it's not installed by default:
One more way to check all the members of a group is by checking the
/etc/group
file which lists all the groups and its membersExample:
The first string (separated by :) specifies the group name and the last string specifies the user added to this group.