groupmod command in Linux is used to modify or change the existing group on Linux system. It can be handled by superuser or root user. Basically, it modifies a group definition on the system by modifying the right entry in the database of the group.
groupmod [option] GROUP
Files: The groupmod command has following files.
- /etc/group: Group Account Information.
- /etc/gshadow: Secured group account information.
- /etc/login.def: Shadow passwd suite configuration.
- /etc/passwd: User account information.
- 0: Success.
- 2: Invalid command Syntax.
- 3: Invalid argument to option.
- 4: specified group doesn’t exist.
- 6: specified group doesn’t exist.
- 9: group name already in use.
- 10: can’t update group file.
Options: There are following option available in groupmod command.
- -g, –gid GID: The group ID of the given GROUP will be changed to GID.
- -n, –new-name NEW_GROUP: The name of group will change into newname.
- -h, –help: This option display help massage and exist.
- -o, –non-unique: This option used with the -g option that allow to change the group GID to a non-unique value.
- -p, –password PASSWORD: This gives the encrypted password.
- -R, –root CHROOT_DIR: Apply changes in the CHROOT_DIR directory and use the configuration files from the CHROOT_DIR directory.
Example: Below command will change the group group_old to group_new using -n option.
groupmod -n group_new group_old
- dc command in Linux with examples
- ip command in Linux with examples
- if command in linux with examples
- cal command in Linux with Examples
- atq command in linux with examples
- apt command in linux with examples
- cut command in Linux with examples
- cpp command in Linux with Examples
- rev command in Linux with Examples
- top command in Linux with Examples
- cp command in Linux with examples
- ps command in Linux with Examples
- id command in Linux with examples
- dir command in Linux with examples
- which command in Linux with examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.