Welcome back. So in this lesson, we are
going to see how we can give executing permissions
so far. We have seen the
read permission the right permission. We have given the
permissions we have removed the permissions, but
we have not seen what are the
execute permissions? All right. So let's
quickly see how we can give and remove the
execute permissions and what happens
when we do that so execute permission
is denoted by X.
So, let's quickly give or remove
the permissions and see what happens.
All right. So here we have a file which is XY said
and here we can see the permissions which
is given to the user is read write execute.
The group has read write execute
others do not have any permissions. So
let's quickly first remove the permissions of
execute for everyone. So
that is a minus X for the file
XY said
And now as you can see, none of
them have the execute permission.
So now what does execute mean that
basically means that the file cannot
be executed if the file is a script it
cannot run. So let's quickly make
this file a script. So let me just open it.
And here let us remove everything first and let's
execute two or three
simple commands. So the First Command that
we are going to execute is Eco.
Now Eco is something which is used to print
something on the screen or The
Terminal. So let's say we print high that's it.
And the second command that we are going to execute now
is
who am I?
And the third simple command that we are going to execute is
LS.
So I have added semicolon in between
which is a separator between two commands. All
right, so let me quickly save this.
And now let me try to execute the
file. So how do we execute files
in Linux for that? We use this combination,
which is Dot and slash. So
let's try to quickly execute this.
And you can see we got a error and the error
is permission denied because it
is saying right we do not have permissions given
to the file as we have seen over here. There is no
X that means there is no execute permission.
All right. So let's quickly give the execute permission
to this file and we know that how to
do it which is chmod and user
plus execute permission
to the file x y z
and now it looks perfect.
Let's quickly verify that we have given
the permissions or not and you can
see the user which is root has the
X now, which is the execute permission.
Now, let's quickly try to run
the same command again and see if this
time the file gets executed or
not.
Let's hope it gets executed because we have given the
right permission and let me just hit enter.
Perfect.
Our commands got executed. The first
was Eco to print high on
the screen that has got successfully executed. The second
one was who am I and yes,
the user which is currently logged
in as root and the third command
that got executed is LS successfully and
we are able to list all the content
into the current present working directory.
So this is perfect. We are able to successfully give
the execute permission and we
are able to see how it works. I hope you guys understood
in case you have any issues. Feel free
to open a thread into the Q&A section, or
feel free to ask me. Thank you.