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.
groupmod -g analytics analystsIncorrect. -g expects a numeric GID.
groupadd -n analytics analystsIncorrect. groupadd creates rather than renames.
usermod -l analytics analystsIncorrect. 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
Account record
Identity attributes such as a user ID, home directory, and login shell.
Group membership
Primary and supplementary groups used during permission checks.
Password aging
State and time limits that control password changes and account access.