How to Find Which Groups a User is Assigned

You can use the following command to print the groups, a user is in. It will print group memberships for each USERNAME or, if no USERNAME is specified, for the current process (which may differ if the groups database has changed).

Taking an example as below,

groups itsiti
itsiti : dhiya-group dba-group web-group

Alternatively, you can use below command as well,

id -Gn itsiti
itsiti : dhiya-group dba-group web-group

You will be getting the same output from both commands and from the output, it shows that user itsiti is assigned into 3 groups (dhiya-group, dba-group and web-group).

You May Also Like

Leave a Reply?