Group Management in Linux

Primary and secondary groups are the two types of categories that may be found in the Linux operating system’s grouping mechanism. The Primary Group is a group that is automatically created when a user with a distinct user ID is being created. Simultaneously, a group with an ID that is identical to the user ID is being created, and the user is then added to the group, at which point they become the group’s first and only member. The term “main group” refers to this particular group. The secondary group is a group that can be formed independently with the assistance of commands, and after it has been made, we can add people to it by altering the group ID of the users.

Create a Group

  • To create a new group enter the following command into the root shell:
$ sudo groupadd Group_name
sudo groupadd ELearnBee

List Groups

  • Use the following command to list all the existing groups:
cat /etc/group
  • To list newly created groups use the following command:
tail -3 /etc/group

Note: -3 option is used to view the last three groups from the  bottom (Note: If you want to know more about “tail” command click here).

Change a Group Name

  • Use the following command to change a Group Name:
$ sudo groupmod -n New_Group_name Old_Group_name
sudo groupmod -n ElearnBee_new ELearnBee

Delete a Group

  • Use the following command to delete a group:
$ sudo groupdel Group_name
sudo groupdel ELearnBee_new

Feedback

Do you want to provide us with feedback? Provide us with feedback directly at info@elearnbee.com.

Share us:

AD BLOCK 1