Show user groups on Linux

On most standard Linux operating systems you can view the current users’
group membership with:

id -nG

or if you’re currently logged in as root then you can just tag the user
that you want to view on the end of the command. For example, if I’m logged in
as root and want to see the groups that john is a member of:

id -nG john

which will then output:

root@mimas:~# id -nG john
john docker