How to List All the Members of a Group on Ubuntu

How do you get a list of all the members of a group on Ubuntu?

To do this, you can use the getent command, which stands for “get entries” and is used to get data from database like files on Linux systems.

Here’s what the command looks like (replace name_of_group with your group name)

1
getent group name_of_group

This command will output something like this:Output

1
name_of_group:x:27:bob,bill

This command queries the /etc/group file in your system and gets each entry that matches name_of_group.