groups is a really simple and useful command in Unix: it lists all the Unix groups that a given user belongs to.
List Groups for the Current User
If you ever want to confirm the groups your own user belongs to, simply type groups command winthout any parameters..
Your actual groups will greatly vary by the Linux distro or Unix OS you're using.
For exampe, here's a regular user I have setup on one of my Raspberry Pi systems:
[email protected]:~ $ groups tty video input
tty, video and input are the only there groups I'm in.
On MacOS you'll see a lot more groups:
[email protected]:~ $ groups staff com.apple.sharepoint.group.1 everyone localaccounts _appserverusr admin _appserveradm _lpadmin com.apple.sharepoint.group.2 com.apple.sharepoint.group.3 _appstore _lpoperator _developer _analyticsusers com.apple.access_ftp com.apple.access_screensharing com.apple.access_ssh
Confirm Groups for Another User in Unix
If you want to list groups of someone else on your system, you need to specify a username.
On the same Raspberry Pi I mentioned, there's a default user that comes pre-installed with the Raspbian OS, called pi. This user has a lot more groups:
[email protected]:~ $ id pi uid=1000(pi) gid=1000(pi) groups=1000(pi),4(adm),20(dialout),24(cdrom),27(sudo),29(audio),44(video),46(plugdev),60(games),100(users),101(input),108(netdev),999(spi),998(i2c),997(gpio)