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.
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.
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.
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.
Related learning recommendations:
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!