Linux groupadd Command
The groupadd command is used to create a new work group; information about 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 of the groupadd command is as follows:
groupadd [-g gid [-o]] [-r] [-f] group
Parameter Description:
- -g: Specify the id;
- -r: Create a system work group; system groups have a group ID less than 500;
- -K: Override the configuration file /etc/login.defs;
- -o: Allow adding a work group with a non-unique group ID.
- -f,--force: If the specified group already exists, this option will cause it to exit with a success status. When used with -g and the specified GID_MIN already exists, another unique GID is chosen (i.e., -g is disabled).
Example
Create a new group and add a group ID.
#groupadd -g 344 runoob
At this point, an entry with a group ID (GID) of 344 is created in the /etc/group file.
Linux Command Reference