Introduction
The Linux command -g is used to specify the group ID for the group. This command is used to set the group ID of a file or directory to the specified group ID. It is also used to set the group ID of a user to the specified group ID. This command is useful for setting permissions on files and directories, as well as for setting user access rights. It is also used to set the group ID of a process to the specified group ID.
Examples
chgrp -R -g
Example:
chgrp -R -g 1000 /home/user/Documents
The groupmod
command in Linux allows you to modify an existing group by changing its Group ID (GID). To use this command, you must be logged in as the root user.
Syntax:
groupmod -g GID group
Where GID
is the new Group ID you want to assign to the group, and group
is the name of the group you want to modify.
Example:
groupmod -g 500 mygroup
This command will change the GID of the group mygroup
to 500.
Note: You should be careful when changing the GID of a group, as it can cause problems if the GID is already in use by another group.