Ubuntu Linux user groups

As an Ubuntu system administrator, you can create and manage groups for the user accounts on your system. This way you can assign administrative & configurations rights, files & folder access permissions to an entire group rather than a single user at a time. Sometimes we need to know which user group a user belongs to in order to verify or perform group management operations or for assigning/de-assigning user rights. This Group Management on Ubuntu 20.04 only through the command line. In this article, we will describe the simple commands used to perform this effortless check.

Open the Ubuntu Terminal through Ctrl+Alt+T or through the Dash.

Enter the following command in order to see which group the current user belongs to:

$ groups

This command lists all the groups that you belong to.

Enter the following command to check which group a certain user belongs to:

$ groups [username]

You can also use the following command to list the group members along with their GIDs.

$ id [username]

Here is an example for the ‘guest’ user:

Groups the guest user belongs to

The gid output represents the primary group assigned to a user.

Enter the exit command in order to close the terminal window in case you do not want to work further.

Through this simple procedure, you can perform a simple check of a user account’s group information.

How to Check the User Group(s) an Ubuntu User Belongs To