Groups help define the permissions and access your Linux user account has to files, folders, settings, and more. Finding out the groups to which a user account belongs helps give you a better understanding of that user’s access (and troubleshoot when things don’t work right).
Note: We’re using Ubuntu for our examples here, but this command works just the same on most flavors of Linux.
Start by opening up your Terminal. At the prompt, type the following command, and then hit Enter:
Just using the groups command by itself like that shows you the groups to which the currently logged in user belongs.
You can also add a username after the groups command if you’re investigating group membership for a different account. Just use the syntax:
Yes, it’s a super simple process, but it’s also a super helpful one. Of course, you can use the groups command itself for more than just checking membership. For example, you can also use it to add users to groups.