-g: Specify the group ID for the group. Linux Commands – Overview with Examples and FAQs


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.


chgrp -R -g


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.


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.


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.

Jaspreet Singh Ghuman

Jaspreet Singh Ghuman


Passionate Professional Blogger, Freelancer, WordPress Enthusiast, Digital Marketer, Web Developer, Server Operator, Networking Expert. Empowering online presence with diverse skills.

jassweb logo

Jassweb always keeps its services up-to-date with the latest trends in the market, providing its customers all over the world with high-end and easily extensible internet, intranet, and extranet products.


Jassweb, Rai Chak, Punjab, India. 143518
Item added to cart.
0 items - 0.00