Hacking with the “groups” GNU command

20.4 `groups': Print group names a user is in

`groups' prints the names of the primary and any supplementary groups
for each given USERNAME, or the current process if no names are given.
If more than one name is given, the name of each user is printed before
the list of that user's groups and the user name is separated from the
group list by a colon.  Synopsis:

     groups [USERNAME]...

   The group lists are equivalent to the output of the command `id -Gn'.

   The only options are `--help' and `--version'.  *Note Common

   Primary and supplementary groups for a process are normally inherited
from its parent and are usually unchanged since login.  This means that
if you change the group database after logging in, `groups' will not
reflect your changes within your existing login session.  Running
`groups' with a list of users causes the user and group database to be
consulted afresh, and so will give a different result.

   An exit status of zero indicates success, and a nonzero value
indicates failure.

source: http://www.gnu.org/software/coreutils/manual/coreutils.txt
jeffrin cdrom floppy audio dip video plugdev
$groups --help
Usage: 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).
      --help     display this help and exit
      --version  output version information and exit

GNU coreutils online help: 
Full documentation at: 
or available locally via: info '(coreutils) groups invocation'
$groups cdrom
groups: cdrom: no such user
$groups jeffrin
jeffrin : jeffrin cdrom floppy audio dip video plugdev
$groups root
root : root
$groups daemon
daemon : daemon
$groups nobody
nobody : nogroup
$groups messagebus
messagebus : messagebus
$groups colord
colord : colord
$groups hack
groups: hack: no such user
$groups mail
mail : mail
$groups man
man : man

%d bloggers like this: