This is a follow-up question to Why is a user not a member of their private group (UPG)? although the first question isn't really necessary to understand this one.
The command id seems pretty clear...
test@test ~ $ id test
uid=1000(test) gid=1000(test) groups=1000(test),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),113(lpadmin),129(sambashare)
it shows the UID and GID of test (resp. its UPG) and then additionally lists all groups of which the user test is a member.
But then how should /etc/group be read?
test@test ~ $ less /etc/group | grep test
adm:x:4:syslog,test
cdrom:x:24:test
sudo:x:27:test
dip:x:30:test
plugdev:x:46:test
lpadmin:x:113:test
test:x:1000:
sambashare:x:129:test
The group-name at the beginning is pretty clear and also that the number is the GID; and after that the names of the group-members are listed. But why isn't the second last line test:x:1000:test instead of test:x:1000: to indicate, that the user test is member of the group test?
bonus question: what is the x in the second column for?
xindicates groups are password protected or may use encrypted password. The actual password may or may not be set, but there should be entry for that group in /etc/gshadow. As for testuser, it's the group owner. The list should indicate only other users who are members – Sergiy Kolodyazhnyy Aug 27 '18 at 21:48testuser is specified to be a member oftestgroup by their/etc/passwdentry (which lists only the primary group). Mentioning it in/etc/groupwould just be redundant. – muru Aug 28 '18 at 06:10