> ## Content Index
> Fetch the complete content index at: https://linuxhandbook.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# groupadd Command Examples
- URL: https://linuxhandbook.com/groupadd-command/
- Published: 2020-02-17T16:46:03.000Z
- Updated: 2024-04-25T04:08:32.000Z
- Description: The groupadd command in Linux creates new groups. Learn how to use groupadd command to add new groups in Linux.
- Author: Abhishek Prakash
- Tags: Group Management, Commands, #docs-col, #user-commands

While the [useradd command](https://linuxhandbook.com/useradd-command/) creates new users, the groupadd command in Linux creates new groups. It updates the /etc/group file accordingly.

There are not many options with groupadd and its syntax is pretty basic:

```
groupadd [options] group_name
```

Let’s see how to use groupadd command for creating groups in Linux.

✋

Please keep in mind that adding group is administrative task and hence you need to be root or [have sudo rights](https://linuxhandbook.com/check-if-user-has-sudo-rights/). Read more about [creating sudo user](https://linuxhandbook.com/create-sudo-user/) here.

## 1\. Create a new group

To create a new group in Linux, you can use it in the following manner:

```
sudo groupadd new_group_name
```

You can verify that the new group has been created by checking the /etc/group file:

```
abhishek@nuc:~$ sudo groupadd testing
abhishek@nuc:~$ grep testing /etc/group
testing:x:1008:
```

What do you do with a group? You should have some users in it, right? You can add users to group using the [usermod command](https://linuxhandbook.com/usermod-command/). If you want to add multiple users to a group at the same time, you can use the [gpasswd](https://linux.die.net/man/1/gpasswd?ref=linuxhandbook.com) command like this:

```
sudo gpasswd -M user1,user2,user3 new_group_name
```

## 2\. Create a group with specific group ID (gid)

By default, the new group gets created with a group id higher than the GID\_MIN value defined in /etc/login.defs. On most Linux system, this value is 1000.

In other words, you get one of the first available GID after 1000.

But you are not restricted to that. You can create a group with a specific GID in this manner:

```
sudo groupadd new_group_namep -g GID
```

Here’s an example:

```
abhishek@nuc:~$ sudo groupadd test_group -g 678
abhishek@nuc:~$ grep test_group /etc/group
test_group:x:678:
```

## 3\. Create a new system group

When you create a new group, it’s a normal group with GID higher than 1000\. You can also create a system group that automatically takes a group id between SYS\_GID\_MIN and SYS\_GID\_MAX as defined in /etc/login.defs.

```
sudo groupadd -r new_group_name
```

You can see in the example that the group id is less than 1000 and thus indicating that it is not a normal group but a system group (used for system programs).

```
abhishek@nuc:~$ sudo groupadd -r tesla
[sudo] password for abhishek: 
abhishek@nuc:~$ grep tesla /etc/group
tesla:x:998:
```

[5 Commands for Group Management in LinuxGroup is an essential part of Linux system management and security. Check out various commands that you can use for managing groups in Linux.![](https://linuxhandbook.com/content/images/size/w256h256/2021/08/Linux-Handbook-New-Logo.png)Linux HandbookAbhishek Prakash![](https://linuxhandbook.com/content/images/2020/06/Group-Management-Linux-1.jpg)](https://linuxhandbook.com/group-management/)

I hope you find this quick little tutorial helpful in using groupadd command. You may also checkout [how to delete groups with groupdel command](https://linuxhandbook.com/groupdel-command/).

Any questions or suggestions are always welcomed.