chgrp's Examples

to change the group ownership of a file or directory

$ chgrp geeksforgeeks abc.txt

owner of the group is changed fromlinuxtest to numbers

chgrp linuxtest numbers

change the ownership of the group

chgrp wdir pavani.txt

this command gives the information processed by the chgrp

chgrp -v mygroup file1

this command if only changes are made in the groupnme

chgrp -c groupname filename

we can use the file or a group as reference

chgrp reference=Rfile file1

we use recrusive command to change the group name and its contents recursively

chgrp -R file1

-h or -derfence changes group ownership of a symbolic llink file

chgrp -h groupname symbolic file name

-h or -derfence changes group ownership of a symbolic llink file

chgrp -h groupname symbolic file name

hides the error msgs in the output

chgrp -f file1

DevOpsSchool
Typically replies within an hour

DevOpsSchool
Hi there 👋

How can I help you?
×
Chat with Us