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

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.

Jaspreet Singh Ghuman

Jaspreet Singh Ghuman

Jassweb.com/

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.

Contact
San Vito Al Tagliamento 33078
Pordenone Italy
Item added to cart.
0 items - 0.00
Open chat
Scan the code
Hello 👋
Can we help you?