Privacy Policy
© 2025 linux101.dev

Changing File Group with `chgrp`

The `chgrp` command is used to change the group of a file or directory. It's a shorthand for "change group" and is often used alongside `chown`. Changing the file group often requires administrator privileges (using `sudo`).

Basic `chgrp` Usage

Change file group

sudo chgrp [new_group] [file]

Changes the group of the specified file to `new_group`.

Recursive Group Change

Change group of a directory and its contents

sudo chgrp -R [new_group] [directory]

The `-R` (recursive) flag applies the group change to the directory and all files and subdirectories within it.