- Unix Commands Reference
- Unix Commands - Home
groups Command in Linux
NAME
groups - print the groups a user is in
SYNOPSIS
groups [OPTION]... [USERNAME]...
DESCRIPTION
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).
OPTIONS
TAG | DESCRIPTION |
---|---|
--help | display this help and exit |
--version | output version information and exit |
EXAMPLES
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
Advertisements