The groupadd
command is used in Linux to create a new group in the system. This is particularly useful for managing user permissions and organizing users into groups for easier administration.
The basic syntax of the groupadd
command is as follows:
groupadd [options] [group_name]
-g GID
: Specify a numeric Group ID (GID) for the new group.-r
: Create a system group, which typically has a GID less than 1000.-f
: If the group already exists, do not return an error; instead, exit successfully.Here are some practical examples of using the groupadd
command:
groupadd developers
groupadd -g 1500 devteam
groupadd -r sysadmins
groupadd -f existinggroup
-g
option to maintain consistency in GID assignments across different systems.