The following command will list all of the groups of someUser
(the primary group and the supplementary groups):
groups someUser
But is there a way to only get the primary group?
grouplinux
The following command will list all of the groups of someUser
(the primary group and the supplementary groups):
groups someUser
But is there a way to only get the primary group?
Best Answer
See the FreeBSD handbook (information also valid for Linux):
If so, running
id <username>
will showgid=<primary group>
:If you want the command to return just the primary group name, see
man id
:so,
id -gn <username>
should give you what you want.