3.4 Linux Files Part 1
Video Activity
Join over 3 million cybersecurity professionals advancing their career
Sign up with
Required fields are marked with an *
or
Already have an account? Sign In »

Video Transcription
00:01
Hello and welcome to command line basics. This video we're gonna learn about clinics, file commands Part one. I'm Christopher Heller, and let's begin.
00:09
So I'm learning objectives for this video. We're gonna learn the CP Command on what envy does understand with E R M commandos. These are all very important basic file commands. In order to be able to use the lending shell,
00:24
pretty assessment that are in command will not delete important system files. Is this true or false?
00:32
The answer is false. The R M command will delete important critical system files if you tell it to. And especially if you're running as route and you tell it to delete important files, it's not gonna ask you twice, and it'll get do it. So
00:48
it was, you know, unique about Lennox is that it will do exactly what you tell him to.
00:53
Any computer will do exactly what you tell them to. So if you tell them you want to delete some critical system files, it won't ask twice. It'll do it and that you would usually be in a pretty bad spot. So that's why it's important to read through the documentation, understands what your commands are going to do and, you know, take the time to know
01:12
with these outputs are going to be
01:15
so we're gonna start with CP Command, the copy command. Now, what this does is it creates a copy of a file in a new location. So this is very useful. If you want to be able to either move something thio a different folder and have a copy in both folders,
01:30
or say that you want to copy something to a network shares that more people can access it upload,
01:37
you know, work of that file, or say that you want a copy, a whole folder and send that up to a share or shared with someone else. You can use the copy command, the CP Command. So this is very useful. And now you're gonna end up using it all a lot.
01:51
So let's go into my Lennox machine. I'm gonna type l s to see what kind of items I have in my folder.
01:59
And now let's say I want to copy the hello dot to you see five. So I'm gonna type CPI
02:07
hello and pushed have for auto complete
02:10
and say the new finals gonna be new, Hello dot t x t
02:19
and I'm gonna type Alice again.
02:21
And as you could see, we have the new hello, Text e file in there now. And let's say we want to look inside of it to make sure everything is just fun.
02:30
And look at that. We have Hello. Just didn't overwrite. And now it's just can't be old. Hello.
02:37
And it is the same exact file. So this is a very useful way to be able to copy the files quickly and that we can use the dash R thio copy folders as well.
02:49
Now we have the move Command the M V. Commit. Now. This is very similar to copy, except it does not leave a copy of the file of the original file.
03:00
So this is very useful if you wanna, you know, move files within the the same computer, or if you want to get rid of the copy that you have when you're uploading something toe a file share, Um, so it's very important to know that this will not leave the original copy of the file.
03:17
And what's unique about this is that it can also be used to rename files as well. So let's say that you want to be able Thio just rename a file.
03:27
Some Lennox distributions don't come with a rename command, but they do all have the M V command. So in order to change the finally, you can just say envy the old file name and then give it the brand new final name that you want that file tohave and it'll move the file that'll make a copy of it and then to lead the old file
03:46
so you will have a new file name. That way,
03:50
I'll give you a demonstration of this. So let's say this new hello dot t x t file.
03:55
I want to change the file name of it.
04:00
So I have new low that t X t and I'm gonna say knew
04:06
name T X T
04:10
type l s
04:12
and we that we have new name that 60 now. So it's a useful way to rename files as well.
04:20
All right. And now we have our m to remove files to delete files. So this is very important because, you know, you're gonna want to get rid of some files if you don't need a more to free up space.
04:31
But you have to be very careful. Like we were saying in the pre assessment, this is a way that you can delete critical operating system files as well.
04:41
And, uh, we have the dash are in the dash f for recursive and force. And what recursive means is that it will keep the leading things down inside of sub folders inside of where you were working. So it will delete everything all the way down until there isn't anything further.
04:59
And the force it will not prompt you if you are sure you want to leave that file or not.
05:04
So, uh, something you may see online as you may see, somebody telling you to run the command pseudo r m uh, Dash R F slash. And what that does is it will actually remove recursive lee everything inside of the route the slash of your clinics machine.
05:24
So, uh,
05:26
this is kind of ah, me mules. See outline. Just don't do it. It never ends. Well,
05:30
you know, if you're quick demonstration of Ah, the arm command. So let's say we want to delete this new name that t X t. So I'm gonna type R M new
05:42
name,
05:43
Enter and look at that. It is gone. So even though we made a copy of this file and we changed the final name for it, it's not our problem anymore. We didn't want it. We got rid of it.
05:55
All right. Post assessment Which command can also be used to rename files? Is that a C P B and the
06:02
see pseudo or D R M?
06:06
The answer is B M V. This is the command that we can use to rename files by kind of creating a computer file and then deleting the original file.
06:16
The CPI command will leave a copy of the original file. The pseudo command is to run commands his route Not necessarily Well, why We could run the envy command with pseudo wth E N v. Command by itself will do what we need in the arm commanders to remove or delete files, not to rename them.
06:35
Right. So in this video, we learned the CP Command learned what M V does and understood the are in command and how to remove files. And I hope to see you in the next video
Up Next
Similar Content