Hi, everyone.
So in this lesson, we are going to understand the
command which is CH group. So CH
group command is used to change the group ownership of
any file or directory.
As we know in Linux we have users
and groups that have been given to any specific
file or folder, which is directory.
The command is very simple. You can just simplify CH
group the group name that you want
to give to any specific file name or the directory
name.
We will also see how you can use CH group to
recursively give ownership to
a new group to any specific files in
a directory.
So it's the Practical time and let's see the practical.
I want to my terminal right now. I have created
a folder called a CH group.
inside you can see there is one directory called
as di are one and two files
called as file one file to
So for the file one, you can see the group is root. I'm
changing the group to hackedify for file 1.
Let us see the permissions once again and you can
see the group has successfully changed from root
to hacktify.
Let us do the same thing for directory 1 this time.
I'm changing the group to Kali for directory 1.
Let's again see the permissions and we can see successfully
for directory one. The group has
been changed to Kali.
Let's go inside the directory and let's see files.
There are two files called as file 1 and file 2
Unfortunately, the group has not been changed for
these files. Which means whenever we
give any change group command.
To a new ownership group. It will
not recursively change the group
for the files.
So for this we are going to use hyphen R which
stands for recursive and let's change
group Kali for all the files.
Let's run the command and see and you can see successfully we
are able to change the group ownership for
all the files inside any directory recursively.
Thank you.