Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use the groups command of Linux

Shulou Source: shulou.com Published: 2022-06-01 17:34:24 10月03日 Update

This article mainly explains "how to use the groups command of Linux". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn how to use the groups command of Linux.

Format groups [OPTION]... [USERNAME]... Displays all groups in which each entered user name belongs, and defaults to the current process user if no user name is specified (which may cause differences when the user group database changes).

Option description-- help displays help and exits-- version displays version information and exits the instance (1) to show the group to which the current user belongs.

The current user of groups root is root and there is only one primary user group root.

(2) View the group to which user root belongs.

Groups root root: root### expands knowledge

In addition to using the grpups command to see which groups the user belongs to, you can use the following methods. (1) View / etc/group. / etc/group is a user group profile, which can be viewed to query the user group to which a user belongs through the grep command. For example, check the user group that root belongs to.

Grep root / etc/group root:x:0: it can be seen that root only belongs to the primary group root with the same name, not to any other group.

(2) through the id command.

The third column of id root uid=0 (root) gid=0 (root) groups=0 (root) represents the list of user groups to which the user belongs and outputs the ID of the group.

At this point, I believe you have a deeper understanding of "how to use the groups command of Linux". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: User command user group location ownership information content file method user name learning query practical deeper interest only at the same time instance practical actual Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Shulou Information macOS Redmi OPPO Reno