How to list users in a group?

To list users in a specific group in a Unix-like operating system, you can use the getent command or check the /etc/group file. Here are two methods:

Using getent:

getent group groupname

Using /etc/group:

You can also view the contents of the /etc/group file:

cat /etc/group | grep groupname

Example:

If you want to list users in the group "sudo", you would run:

getent group sudo

or

cat /etc/group | grep sudo

Both commands will display the group information along with the users that belong to that group. If you have further questions, feel free to ask!

0 Comments

no data
Be the first to share your comment!