Create new group analysts with GID 3100.
Which command is appropriate?
groupadd -g GID NAME creates a group with an explicit numeric GID.
Detailed explanation
groupadd -n 3100 analystsIncorrect. groupadd -n is not the GID option.
Incorrect. groupadd -n is not the GID option.
groupmod -g 3100 analystsIncorrect. groupmod changes an existing group.
Incorrect. groupmod changes an existing group.
useradd -g 3100 analystsIncorrect. useradd creates a user, not a group.
Incorrect. useradd creates a user, not a group.
groupadd -g 3100 analystsCorrect. It creates analysts with GID 3100.
Correct. It creates analysts with GID 3100.
Try it yourself
An example you can run in a temporary verification environment.
groupadd --help | grep -E -- '-g,|--gid'Expected result
GID指定の説明行Key points
- groupadd creates a group
- -g selects the GID
- groupmod changes an existing group
Notes
- Environment: shadow-utils groupadd help / 状態変更なし
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.