groupadd - Linux


The groupadd command in Linux is used to create a new user group on the system. It helps in managing permissions by grouping multiple users under a single group, allowing administrators to assign permissions and access rights to a collective rather than to individual users. This command is commonly used in the administration of multi-user environments.


The basic syntax for the groupadd command is as follows:

groupadd [options] groupname
  • groupname: This is the required argument where you specify the name of the new group.


The groupadd command includes several options to modify its behavior:

  • -g, –gid GID: Specifies the group ID for the new group. This value must be unique, unless the -o option is used.
  • -o, –non-unique: Allows the creation of a group with a non-unique GID (when used with -g).
  • -r, –system: Create a system group with a GID less than 1000 (or another threshold, depending on the system).
  • -K, –key KEY=VALUE: Overrides /etc/login.defs defaults. For instance, groupadd -K GID_MIN=100 -K GID_MAX=499 adjusts the range of allowed group IDs.
  • -f, –force: This option causes the command to exit with a success status if the specified group already exists. When specified with -g, it also forces the use of a non-unique GID.
  • -h, –help: Displays help information and exits.


  1. Creating a Basic Group:

    groupadd developers

    This command creates a new group named ‘developers’.

  2. Assigning a Specific GID:

    groupadd -g 1010 multimedia

    Creates a new group named ‘multimedia’ with a GID of 1010.

  3. Creating a System Group:

    groupadd -r sysadmins

    This command creates a new system group named ‘sysadmins’.

Common Issues

  • GID Not Unique: When a specified GID already exists and the -o flag is not used, groupadd will fail. Ensure GID uniqueness or use the -o flag.
  • Permission Denied: Running groupadd without sufficient privileges (not as root or without sudo) results in a permission denied error. Execute the command with sudo or as the root user.


groupadd can be combined with other commands for more complex tasks:

groupadd project && usermod -a -G project alice

This snippet first creates a new group called ‘project’, then adds the user ‘alice’ to this group using usermod.

  • useradd: Adds a new user to the system.
  • usermod: Modifies a user account.
  • groupmod: Modifies a group.

For further reading and more detailed information, consult the groupadd man page by running man groupadd in your terminal.