Home » Linux » Basic Commands » How to check Groups of User in Linux ?

How to check Groups of User in Linux ?

In Linux, which is a multi user operating system, we can group few number of users from all users and create a group of those users to assign certain permissions.

By default, when you create a new user in Linux, it also creates a group with same name. i.e. the user is in group of itself when it is created, but you can change the group of the user from one group to another.

In this post, we will see how you can check the group membership of the user.

$ groups

devlab adm cdrom sudo dip plugdev lpadmin sambashare

As, we can see there are multiple groups available in the system, and our user “devlab” is part of those many groups.

We can also check the same using “id” command as,

$ id

uid=1000(devlab) gid=1000(devlab) groups=1000(devlab),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),116(lpadmin),126(sambashare)
Change the User Primary Group on Li...
Change the User Primary Group on Linux - Ansible module user

Leave a Comment