LinuxMoz

Linux Stuff && Coffee

Chgrp Linux Command

The chgrp Linux command is used to change the group of one or more files to a newgroup. The newgroup can either be the name found in /etc/group or the group ID number, you will need to own the file to change the group or have the correct user privileges.

Situations when the chgrp Linux Command is useful

  • Change the group of a file in Linux
  • Change the group of multiple files in Linux
  • Recursively change the file group in Linux

chgrp command example

1
chgrp [options] newgroup files

chgrp command options

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
-c, –changes

    Prints information about files that are changed

-f, –silent, –quiet

    Prevents error messages displaying about files that cannot be changed

–help

    Prints the help message & exits

-R, –recursive

    traverse subdirectories recursively. applying changes

–reference=filename

    Change the group to that associated with filename. In this case, newgroup is not specified.

-v, –verbose

    Verbosely describe the ownership changes

–version

    Print version information and then exit

Comments