Home  >  Article  >  Operation and Maintenance  >  How to check which group a user belongs to in CentOS?

How to check which group a user belongs to in CentOS?

coldplay.xixi
coldplay.xixiOriginal
2020-07-06 15:28:0819293browse

How to check which group a user belongs to in centos: 1. Groups command method, just execute the groups command to view; 2. View [/etc/group] method, use the grep command to query the user a certain user belongs to Group; 3. ID command method, you can view it by just executing the id command.

How to check which group a user belongs to in CentOS?

centos method to check which group a user belongs to:

Method 1, groups command method## The

#groups command can be used to view the user groups to which a user belongs. Execute the groups command only to view the user groups of the currently logged-in user in the system.

How to check which group a user belongs to in CentOS?

#To query the user group to which a specific user belongs, you can follow the user. As shown in the figure below, query the user group where the air user belongs.

How to check which group a user belongs to in CentOS?

Method 2. View /etc/group method

/etc/group is the user group configuration file, you can view this file and use the grep command to query the user group a certain user belongs to. As shown in the figure below, it is found that the air user belongs to the air and sudo user groups.

How to check which group a user belongs to in CentOS?

Method 3, id command method

id command can also view the users to which a user belongs Group, just execute the id command to view the user group to which the currently logged in user belongs.

How to check which group a user belongs to in CentOS?

#To query the user group to which a specific user belongs, you can follow the user. As shown in the figure below, query the user group where the air user belongs.

How to check which group a user belongs to in CentOS?

Related learning recommendations:

centos tutorial

The above is the detailed content of How to check which group a user belongs to in CentOS?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:How to run sh on centos?Next article:How to run sh on centos?