CompTIA Linux+ (XK0-006)Services and User ManagementEasy
A system administrator needs to create a new group named `devteam` with a specific GID of `5000`. Which command will accomplish this?
- Anewgroup -g 5000 devteam
- Baddgroup --gid 5000 devteam
- Cgroupmod -g 5000 devteam
- Dgroupadd -g 5000 devteam
Show answer & explanationAnswer & explanation
Correct answer: D. groupadd -g 5000 devteam
The `groupadd` command is the standard Linux utility for creating new groups. The `-g` option is used to specify a particular GID for the new group.
Why the other options are wrong
- A. `newgroup` is not a standard Linux command for creating groups.
- B. While `addgroup` is often a wrapper for `groupadd` on some distributions, the `--gid` long option is not universally supported or the most common way to specify GID with `groupadd` directly.
- C. `groupmod` is used to *modify* an existing group, not create a new one.
groupadd command
The `groupadd` command is used to create a new group account on a Linux system, allowing specification of a GID.
- Creates new group accounts.
- Requires root privileges.
- Option: `-g` (GID).
Memory trick: GROUPADDs a new group with a GID.