How To Find Out Which Group a Unix User Belongs To

If you know the name of a particular user on your Unix system and just want to confirm the primary Unix group (gid) of this individual, just use the id command:

$ id -g greys
115

If Unix group id (gid) for the user doesn't help you much and you're interested in the Unix group name, use this:

$ id -gn greys
admins

If you want to get all the information about the user id and all the groups the user belongs to, it's easier to use the default id command:

$ id greys
uid=1000(greys) gid=115(admins) groups=35(testgroup),115(admins)

See also:

3 comments ↓

#1 List Groups A User Belongs To In Unix | UNIX Tutorial: Learn UNIX on 07.14.08 at 2:33 pm

[...] Finding the primary Uinx group a user belongs to [...]

#2 rod on 01.12.11 at 3:50 pm

very clear, thank you

#3 sandy on 12.06.11 at 5:51 pm

Thank you

Leave a Comment