Prints the name of the group to which the specified user belongs.
groups [OPTION]... [username]...
--help Display help information and exit.
--version Display version information and exit.
username (optional): It can be one or more. If not provided, it defaults to the current user.
Returning 0 indicates success, returning a non-zero value indicates failure.
Display the groups to which the linux user belongs
[root@localhost ~]# groups linux
linux: linux adm dialout cdrom plugdev lpadmin admin sambashare
This command is equivalent to id -Gn.
Each user belongs to a group specified in /etc/passwd and other groups specified in /etc/group.
This command is a command in the GNU coreutils package. For related help information, please see man -s 1 groups, info coreutils 'groups invocation'.
优先推荐相关内容,同时保留你的阅读轨迹和收藏入口。