Home > Operation and Maintenance > Linux Operation and Maintenance > How to check which group a user belongs to in Linux

How to check which group a user belongs to in Linux

王林
Release: 2020-03-11 15:46:58
Original
5666 people have browsed it

How to check which group a user belongs to in Linux

There are many ways to view the groups to which a user belongs in Linux:

Command groups to view the groups to which the current user belongs

[root@localhost xly]# groups
root
Copy after login

groups users (view the groups to which the user belongs)

[root@localhost xly]# groups xly
xly : xly
Copy after login

Recommended tutorial: linux tutorial

id user (view the group to which the user belongs)

[root@localhost xly]# id xly
uid=500(xly) gid=500(xly) groups=500(xly)
Copy after login

View the group file directly, cat /etc/group

[root@localhost xly]# cat /etc/group
root:x:0:
bin:x:1:bin,daemon
daemon:x:2:bin,daemon
sys:x:3:bin,adm
adm:x:4:adm,daemon
tty:x:5:
disk:x:6:
lp:x:7:daemon
mem:x:8:
kmem:x:9:
xly:x:500:
Copy after login

cat group name, used to find a user group

cat /etc/group|grep
Copy after login

Related video tutorial recommendations: linux video tutorial

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

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template