In Linux system, a group is a collection of users which have the same permissions on files and directories. When working as system administrator, might need to create a group. This tutorial shows how to do that in Linux.
groupadd command can be used for creating a groups. For example, run the following command to create a new group named
sudo groupadd test-group
By default, if the group already exist, command prints error. The
-f option can be used to make the command exit successfully if the specified group already exist.
sudo groupadd -f test-group
Verify that group is created:
cat /etc/group | grep -w test-group
Create group with specific GID
Each group is identified by unique identifier known as group ID or GID. GID is automatically assigned to group when it created. The
-g option can be used to create a group with a specific GID.
sudo groupadd -g 1100 test-group
Command prints error if a group already exist with the given GID.