groups - print the groups a user is in
groups [OPTION]... [USERNAME]...
Print group memberships for each USERNAME or, if no USERNAME is specified, for the current process (which may differ if the groups database has changed).
TAG | DESCRIPTION |
---|---|
--help | display this help and exit |
--version | output version information and exit |
Example-1:
To print groups of currently logged in root user:
# groups
output:
root
Example-2:
To print groups of currently logged in normal user, for ubuntu user login:
ubuntu@ubuntu:~$ groups
output:
ubuntu adm cdrom sudo dip plugdev libvirtd lpadmin sambashare
Example-3:
To print groups of user:
$ groups ubuntu
output:
$ groups ubuntu
ubuntu : ubuntu adm cdrom sudo dip plugdev libvirtd lpadmin sambashare