1. Home
  2. Linux
  3. Linux User and Group
  4. Linux – addgroup

Linux – addgroup

Linux Add Group

Use groupadd or addgroup command to create new user group in Linux system.

Syntax:

$ addgroup GROUP_NAME

Example:
Let’s create a group named “testgroup”.

$ addgroup testgroup

Add User to Group

Use usermod command to add user in secondary group.

$ usermod -G testgroup testuser

You can view the group’s names of the user belongs to.

$ groups testuser

testuser : testuser testgroup 

Assign Group during Create New User

You can also assign the specific group during create creation process. This will also create the primary group

$ useradd -G testgroup rahul