Linux Command
groups
Prints the name of the group to which the specified user belongs.
Summary
groups [OPTION]... [username]...
The main purpose
Options
--help Display help information and exit.
--version Display version information and exit.
Parameters
username (optional): It can be one or more. If not provided, it defaults to the current user.
return value
Returning 0 indicates success, returning a non-zero value indicates failure.
example
Display the groups to which the linux user belongs
[root@localhost ~]# groups linux
linux: linux adm dialout cdrom plugdev lpadmin admin sambashare
Notice
-
This command is equivalent to
id -Gn. -
Each user belongs to a group specified in
/etc/passwdand other groups specified in/etc/group. -
This command is a command in the
GNU coreutilspackage. For related help information, please seeman -s 1 groups,info coreutils 'groups invocation'.


