Linux Commands and Scripts

How to Create Group in Linux

Groups are used to organize users and their privileges such as reading the writing and executing permission. To add a groud, the command is groupadd.

The groupadd command creates a new group account using the values specified on the command line plus the default values from the system. The new group will be entered into the system files as needed.
In this article, we will discuss how to add a new group using groupadd command.

To create a new group

# groupadd [Group Name]

Create a new group with specific group id (GID)

# groudadd -g [id] [Group Name]

-g, gid: The numerical value of the group’s ID

Create a group with non-unique GID

# groupadd -o -g [id] [Group Name]

-o, –non-unique: This option permits to add a group with a non-unique GID.

To verify newly create group, run following command

# getent group | grep [Group Name]

Related Articles