Why is it that group1 which should be user's primary group, is in the subgroups? The user is not even part of group1 in /etc/group file.

# id user
uid=1000(user) gid=1111(group1) groups=1111(group1),1112(group2),1113(group3)

From my fairly new knowledge about *nix systems, isn't it that gid=1111(group1), is the primary group. While all groups under groups= is a subgroup? Then why is it by default that the primary group is being listed in groups=

1 Answer 1


groups lists all groups a user belongs to, not just all the others.

from man id:

By default, it prints the real user ID, real group ID, effective user
ID if different from the real user ID, effective group ID if different
from the real group ID, and supplemental group IDs.  In addition, if
SELinux is enabled and the 'POSIXLY_CORRECT' environment variable is not
set, then print 'context=C', where C is the security context.
  • Thanks but i cannot understand it fully, I am sorry. So in Linux, groups list all a users belongs to (either primary and supplementary group). How do I list primary group or all supplementary group a user belong? In AIX, I believe groups only list the supplementary groups.
    – Ykaly
    Jun 24, 2019 at 15:00
  • @Ykaly , man id will show you: id -g will give you only primary group. id -G - all groups user belongs to. To my knowledge, there's no command that would show only supplementary groups.
    – Bart
    Jun 24, 2019 at 15:05
  • @Bart8 , thanks. Your explanations is very helpful. Although I just want to confirm if my understanding is correct that in AIX groups display only supplementary group
    – Ykaly
    Jun 24, 2019 at 15:18
  • @Ykaly, of that I'm not sure as I don't know the system, but maybe it's documentation or someone else would give you the answer
    – Bart
    Jun 24, 2019 at 21:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .