Linux: Find Out My Group Name [ Group Memberships ]

by on January 21, 2011 · 3 comments· LAST UPDATED January 21, 2011


How do I find out the group name under Linux operating systems using bash shell prompt? How do I display group information for the specified USERNAME under Linux?

Open a command-line terminal (select Applications > Accessories > Terminal), and then type the following command to list your group ownership i.e. display the groups a user is in:
$ users
Sample outputs:

vivek adm dialout cdrom plugdev lpadmin netdev admin sambashare libvirtd

vivek user is part of the above groups. To display group memberships for a user called tom, enter:
$ users userName
$ users tom

To print the primary group membership for a user called tom, enter:
$ id -g -n tom
To print the secondary group membership for a user called tom, enter:
$ id -G -n tom
You can also search /etc/group file as follows using the grep command:
$ grep Username /etc/group
$ grep vivek /etc/group

Sample outputs:


See also:

If you need assistance with Linux groups membership related commands, turn to the man page first. It will give you detailed information, parameters and switches for the following commands:
$ man id
$ man groups
$ man 5 group

Tweet itFacebook itG+ itDownload PDF versionFound an error/typo on this page?

{ 3 comments… read them below or add one }

1 mary poppins January 31, 2011 at 9:46 am

$ grep vivek /etc/group
$ getent group vivek

$ grep vivek /etc/passwd
$ getent passwd vivek


2 john January 30, 2013 at 4:38 pm

According to the users man page, the users command prints the user names of users currently logged in to the current host. The “groups” command will print the groups a user is in.


3 Dan Dascalescu June 30, 2014 at 8:48 pm

This article is incorrect and needs to be updates. “users” will only display who’s logged in.

Please make this correction because Cybercity is the top Google results for a lot of Linux-related searches.


Leave a Comment

Tagged as: , , , , , , , , , ,

Previous Faq:

Next Faq: