Rename existing group analysts to analytics while keeping its GID.
Which command is appropriate?
groupmod -n NEW_NAME OLD_NAME changes the name of an existing group and leaves its GID unchanged.
Detailed explanation
groupmod -n analytics analystsCorrect. It renames analysts to analytics.
Correct. It renames analysts to analytics.
groupmod -g analytics analystsIncorrect. -g expects a numeric GID.
Incorrect. -g expects a numeric GID.
groupadd -n analytics analystsIncorrect. groupadd creates rather than renames.
Incorrect. groupadd creates rather than renames.
usermod -l analytics analystsIncorrect. 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 | grep -E -- '-n,|--new-name'Expected result
new group nameの説明行Key points
- groupmod changes an existing group
- -n selects the name
- -g changes the GID
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.