Donate : Link
Medium Blog : Link
Applications : Link
In linux, there can be multiple users(those who use/operate the system), and groups are nothing but the collection of users. Groups make it easy to manage users with the same security and access privileges. A user can be part of different groups.
Important Points:
- Groups command 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 username is separated from the group list by a colon.
~# 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: <https://www.gnu.org/software/coreutils/>
Report groups translation bugs to <https://translationproject.org/team/>
Full documentation at: <https://www.gnu.org/software/coreutils/groups>
or available locally via: info '(coreutils) groups invocation'
Example 1: Provided with a user name
~# groups user1
user1 : user1
~# groups user1 root
user1 : user1
root : root
Example 2: No username is passed then this will display group membership for the current user
user1:~$ groups
user1
root:~# groups
root

