Get All Members of a Group in Linux

Get All Members of a Group in Linux

In the Linux system, a group is a collection of users which have the same permissions on files and directories. When working as system administrator, might need to get all members of a group. This tutorial shows how to do that in the Linux.

The getent can be used to retrieve entries from database files in the /etc directory such as group, passwd, hosts, etc. For example, to get all members of a sudo group, execute the following command:

getent group sudo | cut -d: -f4

Example output:

adminer,john,james,mary

Leave a Comment

Cancel reply

Your email address will not be published.