Rename the existing group dev to developers while keeping its GID.
Which command is appropriate?
groupmod -n NEW_NAME OLD_NAME changes a group name without changing its GID.
Detailed explanation
groupmod -g developers devIncorrect. -g changes a numeric GID, not a group name.
Incorrect. -g changes a numeric GID, not a group name.
groupmod -n developers devCorrect. -n developers dev renames the group.
Correct. -n developers dev renames the group.
groupadd -n developers devIncorrect. groupadd creates a new group rather than renaming an existing one.
Incorrect. groupadd creates a new group rather than renaming an existing one.
usermod -l developers devIncorrect. usermod -l changes a user login name.
Incorrect. usermod -l changes a user login name.
Try it yourself
An example you can run in a temporary verification environment.
groupmod --help 2>&1 | grep -E -- '--new-name|-n,' | head -n 1Expected result
-nまたは--new-nameの説明Key points
- -n new name
- Old name last
- GID remains
Notes
- Environment: shadow-utils groupmod / 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.