Hi, this is Sandra Henry-Stocker, author of the “Unix as a Second Language” blog on NetworkWorld.
In this Linux tip, we’re going to look at the groups command that provides a list of the groups that a user is a member of. It does this by pulling information from the /etc/group and /etc/passwd files. Here’s an example:
The username is shown on the left and the group list on the right. This is easier to see when there’s more than one group:
As you probably know, the primary group assigned to each user on most Linux systems today is the same as the person’s username.
If you run the groups command without an argument, it will list the groups that you are a member of – whichever account you are currently logged into or using.
Note that the groups command only lists group memberships. It doesn’t tell you anything more about user privileges that may be provided along with some of those group memberships.
That’s your Linux tip for the groups command.
If you have questions or would like to suggest a topic, please add a comment below.
And don’t forget to subscribe to the IDG Tech(talk) channel on YouTube.
If you liked this video, please hit the like and share buttons. For more Linux tips, be sure to follow us on Facebook, YouTube and NetworkWorld.com.