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 *

Already have an account? Sign In »

5 hours 21 minutes
Video Transcription
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.
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,
pretty assessment that are in command will not delete important system files. Is this true or false?
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
it was, you know, unique about Lennox is that it will do exactly what you tell him to.
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
with these outputs are going to be
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,
or say that you want to copy something to a network shares that more people can access it upload,
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.
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.
And now let's say I want to copy the hello dot to you see five. So I'm gonna type CPI
hello and pushed have for auto complete
and say the new finals gonna be new, Hello dot t x t
and I'm gonna type Alice again.
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.
And look at that. We have Hello. Just didn't overwrite. And now it's just can't be old. Hello.
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.
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.
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.
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.
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
so you will have a new file name. That way,
I'll give you a demonstration of this. So let's say this new hello dot t x t file.
I want to change the file name of it.
So I have new low that t X t and I'm gonna say knew
name T X T
type l s
and we that we have new name that 60 now. So it's a useful way to rename files as well.
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.
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.
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.
And the force it will not prompt you if you are sure you want to leave that file or not.
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.
So, uh,
this is kind of ah, me mules. See outline. Just don't do it. It never ends. Well,
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
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.
All right. Post assessment Which command can also be used to rename files? Is that a C P B and the
see pseudo or D R M?
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.
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.
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