Ukazi za Linux

How to Run 'groups' command in Linux

How to Run 'groups' command in Linux
In Linux, there is user and groups; users use the system, and groups are logical frameworks for managing a set of users. Users can be categorized into various groups, while groups are a set of multiple users.

It isn't easy to manage the privileges such as security and permission rights among different users. Group command makes it easy to manage them at a group level.

Give the username as input; it will return the member's name of primary and secondary groups. If no names are specified, it will print the currently running user information.

Syntax:

Syntax of “group” command would be like this:

$ group [option] [username]

How to use the “group” command:

Open the terminal, type “groups” to print the list of all groups that are currently logged in:

$ groups

Adding username as input:

Provide the username as an argument to get a list of all groups from which a particular user belongs, a username of my Linux device is “aqsa”:

$ groups aqsa

Getting User id:

Use the “id” command to display the information about a user and its groups. The command will show the primary and secondary groups; primary shows the user and group id while secondary shows the username:

$ id aqsa

Displaying usernames:

Use a combination of “-n” and “G” options to print usernames of all groups instead of user ids:

$ id -nG

Displaying group details:

Two ways to display the group's details:

  1. /etc/groups
  2. “getent” command

Use the below-mentioned command to get the list of all Linux groups:

$ cat /etc/group

The “getent” command shows entries from specified databases, which can be used to get a list of all groups:

$ getent group

To get the information of any particular group, pass “username” as an argument:

$ getnent group aqsa

If no output comes, it means the group does not exist.

$ getent group linux

Getting help information:

To print help information, type the “-help” command in a terminal. It gives a brief description and the related links of the “groups” command.

$ groups --help

Checking the version:

To check the version of the “groups” command in Linux, use the “version” command:

$ groups --version

Conclusion:

A “group” in Linux is a collection of users. The “groups” command lists all the groups and their details in the terminal. Groups make it simple to handle users who have similar security and access rights. We can also use the “/etc/group” and “getent” commands to display a list of groups. We have learned what the “groups” command is and the functionality of its different options.

HD Remastered Games za Linux, ki prej še niso izdale Linuxa
Mnogi razvijalci iger in založniki pripravijo HD remaster starih iger, da podaljšajo življenjsko dobo franšize, zato oboževalci zahtevajo združljivost...
Kako uporabljati AutoKey za avtomatizacijo iger Linux
AutoKey je namizni pripomoček za avtomatizacijo za Linux in X11, programiran v Python 3, GTK in Qt. Z njegovo funkcijo skriptiranja in MACRO lahko avt...
Kako prikazati števec FPS v igrah Linux
Linux gaming je dobil velik zagon, ko je Valve leta 2012 napovedal podporo Linuxu za odjemalca Steam in njihove igre. Od takrat se je veliko AAA in in...