Linux/Unix – Groups and How to Work with
Groups and How to Work in Them
A group is a set of users, created to share files and to facilitate collaboration. Each member of a group can work with the group’s files and make new files that belong to the group. The system administrator can add new groups and give users membership to the different groups, according to the users’ organizational needs.
For example, a system used by the crew of a ship might have groups such as galley, deck, bridge, and crew; the user captain might be a member of all the groups, but user steward might be a member of only the galley and crew groups.
On a Linux system, you’re always a member of at least one group: your login group. You are the only member of this group, and its group name is the same as your username. Let’s look at how to manage your group memberships.
Listing the Groups a User Belongs To
To list a user’s group memberships, use the group tools. Give a username as an argument, and groups output a line containing that username followed by all of the groups the user is a member of. With no arguments, group lists your own username and group memberships. To list your group memberships, type:
steward esdsvd mgsotoso
In this example, three groups are output: steward (the user’s login group), esdsvd, and mgsotoso. To list the group memberships of user blackbeard, type:
$ groups blackbeard
blackbeard : blackbeard
In this example, the command outputs the given username, blackbeard, followed by the name of one group, blackbeard, indicating that user blackbeard belongs to only one group: his login group.
Listing the Members of a Group
To list the members of a particular group, use the members tool, giving the name of the particular group as an argument. To output a list of the members of the esdsvd group, type:
$ members esdsvd
captain steward mgsotoso
In this example, three usernames are output, indicating that these three users are the members of the