Welcome back.
So in this lesson, we are going to see how we can give executing permissions.
So far, we have seen the right 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 X, Y, Z.
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 X, Y, Z.
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 equal.
Now equal is something which is used to print something on the screen or the terminal.
So let's say we print hi, 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 Ellis.
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 an error and the error is permission denied because it is saying, right, if
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, it is c,
h mod 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 equal to print.
Hi 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 less
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.