The scenario is this. Your file listing is showing you that a file belongs to a particular group, but now the next question that you have is what users are actually members of this group?

Well, getting this information via the command line terminal is pretty simple as it turns out – Just run the getent command:

getent group <GROUPNAME>


getent group <GROUPNAME> | awk -F: '{print $4}'

In case you aren’t familiar with getent:

“getent is a unix command that helps a user get entries in a number of important text files called databases. This includes the passwd and group databases which store user information – hence getent is a common way to look up user details on Unix. Since getent uses the same name service as the system, getent will show all information, including that gained from network information sources such as LDAP. The databases it searches in are: ahosts, ahostsv4, ahostsv6, aliases, ethers (Ethernet addresses), group, gshadow, hosts, netgroup, networks, passwd, protocols, rpc, services, and shadow.”

Easy peasy :)


Related Link: