Groups

From LQWiki
Jump to: navigation, search

The groups command tells what groups (and supplementary groups) a user or process belong to.

Process information

If groups is run without arguments, it writes the groups that the present process belongs to.

For example:

$ whoami
robot
$ groups
hive

This would be a process owned by user "robot", belonging to group "hive."

User information

If groups is run with a user as an argument, it writes the groups that the named user belongs to.

For example:

$ whoami
robot
$ groups robot
hive dockingbay command

This would be a user "robot", belonging to groups "hive," "dockingbay," and "command." The last two groups, "dockingbay," and "command," are likely suplementary groups, that can be activated with su or newgrp.

Provided by

Most (all?) Linux distributions incorporate this from the GNU Coreutils: and use its man page

Related Commands

All of these relate to user information.

  • id - dump UID and GID information, more powerful than this one, providing more information.
  • logname - show the login name.
  • whoami - show effective user ID.
  • users - show who is logged in.
  • who - show who is logged in from where.

This article is a stub and needs to be finished. Plunge forward and help it grow!