How to find groups a user belongs to ubuntu

How can we find a group to which a particular user belongs to in ubuntu
we have 2 methods using which we can find it.

Method 1

root@chavakula:/# id -Gn user
output will as given below
root sys www-data

Method 2

root@chavakula:/# groups ubuntu
output will as given below
ubuntu : ubuntu root adm dialout cdrom floppy sudo audio dip www-data video plugdev netdev lxd

* Note that Method 2 is deprecated! may be removed from future releases

Working in software industry since last 10+ years, have done feature rich web apps & automations and helped organizations to save cost.

Leave a reply:

Your email address will not be published.