Find Which Groups User Belongs To in Linux

Find Which Groups User Belongs To in Linux

In Linux system, a group is a collection of users which have the same permissions on files and directories. When troubleshooting problems related with access rights, can be helpful to find which groups user belongs to. This tutorial shows how to do that in Linux.

In order to determine which groups current user belongs to, run the groups command without any arguments:

groups

Output example:

john adm cdrom sudo dip plugdev lxd

The first group is the primary group. Other groups are secondary groups.

Provide username as argument to find out which groups specific user belongs to:

groups james

Output example:

james : james sudo

Leave a Comment

Cancel reply

Your email address will not be published.