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: