Linux groupadd command
The groupadd command is used to create a new group, and the information of the new group will be added to the system files.
Related files:
- /etc/group group account information.
- /etc/gshadow secure group account information.
- /etc/login.defs Shadow password suite configuration.
Syntax
The syntax format of the groupadd command is as follows:
groupadd [-g gid [-o]] [-r] [-f] group
Parameter description:
- -g: specify the new group'sid;
- -r: create a system group, the group ID of the system group is less than 500;
- -K: override the configuration file/etc/login.defs;
- -o: allow adding a group whose group ID number is not unique.
- -f,--force: If the specified group already exists, this option will make the command exit with a success status. When used with -g, and the specified GID_MIN already exists, select another unique GID (i.e., -g is disabled).
Examples
Create a new group and add a group ID.
#groupadd -g 344 example
At this point, an entry with a group ID (GID) of 344 is created in the /etc/group file.
Other extensions
Linux Command Encyclopedia