Time
5 hours 21 minutes
Difficulty
Beginner
CEU/CPE
6

Video Transcription

00:00
Hello and welcome to command line Basics. This is Lennox File commands Part two. I'm Christopher Hyler and let's begin.
00:08
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
00:25
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
00:40
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
01:00
execute permission for a file. We wanna add it in order to be able to execute it
01:06
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.
01:25
So it's good to have in your arsenal when you need it.
01:27
So let's go ahead, pull it, my legs machine. I'm going to
01:32
show all of these files inside of this folder,
01:34
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.
01:45
So let's say I want to touch my fur around that way we can update the time stamps
01:52
and it used up arrow twice, flicking it back to the Elvis Dash l A command
01:57
and check it out. Now we have it updated, and it is September 14th at 13. 52.
02:04
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
02:16
and we're going to do for less. Tash l. A. Again,
02:20
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.
02:29
So this is useful to be able to know, and we'll be able to use it to manipulate new things in the show.
02:36
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
02:53
and the permission classes should the user group and then the other in that order.
02:59
So, um,
03:00
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.
03:15
When you use the Jamal command, you can use the symbolic motor or the numerical code never is easier for you.
03:22
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.
03:34
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
03:46
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.
03:55
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.
04:10
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
04:24
and my program
04:27
and as you can see, permission is denied,
04:30
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.
04:43
So I'm gonna say commode plus X
04:46
and my program.
04:48
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.
04:58
So if I do the ford slash dot Ford slashed my program,
05:01
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.
05:12
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,
05:32
and Groot
05:32
is always after the colon. So it will change the group on the ship for that file as well,
05:39
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.
05:46
So let's do a quick demonstration.
05:49
So I want to change this to root for the my program.
05:56
And now let's do another long listing.
05:59
And as you can see, the owner is root for my program now.
06:03
So if that could be useful if you need to change ownership files
06:08
all right, post assessment, which can be used to create files. Is it a Joan?
06:14
Be Jamaat See Touch or D R M?
06:19
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.
06:30
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.
06:42
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

Up Next

Command Line Basics

In this course you will learn the fundamentals of Command Line, a fundamental tool for any user of Windows and Linux machines. Command line allows developers to manipulate files easily and quickly. Learning command line saves developers time and resources.

Instructed By

Instructor Profile Image
Christopher Haller
Senior Intelligence Operations Analyst at Centripetal
Instructor