109

How can I see all the members of a group in Linux?

134

Use the commands:

getent group groupname

or

getent group groupname | awk -F: '{print $4}'
  • 1
    So to add group, add user to group, change permissions of folder to group, and get all members of group, you would run the following commands respectively: addgroup programmers adduser donato programmers chown -R root:programmers idea-IU-141.1010.3 getent group programmers – Donato Jun 9 '15 at 4:56
  • chmod -R g+w idea-IU-141.1010.3 – Donato Jun 9 '15 at 5:14
  • Interesting find, "getent groups" (without any group specified) and "cat /etc/group" both give exactly the same output, at least on my system. – okolnost Oct 4 '16 at 22:43
8

use "members " and it will list all users in the group you chose

  • 1
    where did you find such command? – Jakuje Dec 10 '15 at 9:24
  • 7
    You may need to install it sudo apt-get install members – Ben Holland Dec 21 '15 at 19:40
6

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.