Hello and welcome to command line Basics. This is Lennox File commands Part two. I'm Christopher Hyler and let's begin.
So we're learning objectives for this video. You don't learn touch command, understand the mod command. Understand the Chone command as well. These are very important in order to execute files on your Lennix machines that change these permissions in order to keep them secure as well
pre assessment. You need to execute a file but lack the permissions which Jamaat switch will allow you to execute. This file said a plus W B minus w c plus x or D minus X
and the answer is C plus X. This is the execute bit in order to execute a file uh, the W and the minus w What that does is the right permission, not the execute permission and the minus X permission takes away the
execute permission for a file. We wanna add it in order to be able to execute it
aren't so, First is the touch command. Now what this does is we can use it in order to update a files modification time in our lending show and that it can also be used to create files as well. So this is a useful command. If you need to create a file or kind of update something, uh, you know, the final modification time for a specific file.
So it's good to have in your arsenal when you need it.
So let's go ahead, pull it, my legs machine. I'm going to
show all of these files inside of this folder,
and if we take a look, we can see we have the my program file. And it was last on a 5 August 31st at 14. 55.
So let's say I want to touch my fur around that way we can update the time stamps
and it used up arrow twice, flicking it back to the Elvis Dash l A command
and check it out. Now we have it updated, and it is September 14th at 13. 52.
So this is a good way to you update I you know, the time stamps on the floor now we can't see. Use this to create a new fun. So let's say touch new dot file
and we're going to do for less. Tash l. A. Again,
and, as you can see, have our new dot file with nothing in it because there was nothing in there. We were just touching it to create the file.
So this is useful to be able to know, and we'll be able to use it to manipulate new things in the show.
Now we have the linens file permissions. If you're not aware with it, I highly recommend looking it up on your own. And this is just a very quick refresher. Um, so we have the file bits that you see you from a long listing the R W in the exit for the read, write and execute bits for these specific files
and the permission classes should the user group and then the other in that order.
these also get ah, you can use the numeric mode, the Octel mode in the bottom right here, where it will show the bits from each of these symbolic modes for the every Dwight and execute into this off the format.
When you use the Jamal command, you can use the symbolic motor or the numerical code never is easier for you.
So it's important to keep in mind well looking at files who can understand exactly who was access to them. And you know what we need to do when we're manipulating these files.
So the Jamaat command, this changes the file mode bits. So like we were learning about with the limits Permissions. If we need to be able to execute a file, we need tohave that execute permission
eso With this symbolic mode, we can use the art of U X. As we just learned. We can also use the Octa mode to change all of the file bits as well.
And you need to do have the ownership permission with the ownership of the file in order to change the permissions. And if you don't have ownership, you can usually do this with route with the pseudo command as well. So it's important to keep in mind.
Now, let me give you a demonstration. So I have this my program file. This is a program I wrote very quickly. It spits out some text. So in order to run a Lennox program when they used the dot ford slash
and as you can see, permission is denied,
and if we look over here, we can see that nobody has actually cute permission for this program. So it makes sense why we have the permission denied because we don't have that permission to execute.
So I'm gonna say commode plus X
And now let's give another long listing. And as you can see, the my program is green onto, which means that I can execute it. We have this execute permission now.
So if I do the ford slash dot Ford slashed my program,
we could see that my program ran properly. So this is how we know that we were able to change the permissions and executed properly.
And we have the Chone Command. This is to change the file ownership. So, uh, let's say we want to change the final ownership to root for my program. We can do Chone route and then the file. We can also change the group ownership as well, so we can do root Colon group and the, uh,
is always after the colon. So it will change the group on the ship for that file as well,
and it's useful to keep in mind, just like the chunk of the German command. It may require route permissions for what you need to do.
So let's do a quick demonstration.
So I want to change this to root for the my program.
And now let's do another long listing.
And as you can see, the owner is root for my program now.
So if that could be useful if you need to change ownership files
all right, post assessment, which can be used to create files. Is it a Joan?
Be Jamaat See Touch or D R M?
The answer is C touch. Like we learned the touch command. We can create files or just go ahead and change the last modified time for the files as well.
The Chone command of the Jamaat Commander used to change permissions and ownership of files not to create files. The arm command. It will remove files, not create them.
Between this video related, the Touch Command understood that Shemar command and understood the the Chone Command. And I hope to see you in the next video