File maintenance commands in this lesson, we will cover a few of the commands that are used to maintain
or keep or change your files, some of the commands are listed here.
The first one is the copy command copy, which copies one file to another.
The second one is to remove a file, which is R.M. The third one is move.
This command is used to move the location of a file from one location to another or to rename a file.
So it does two things or it serves two purposes.
Then we have mkdir, which is to make directory and then our media to remove a directory.
Or there's another way to remove a directory by typing R.M. Space Dash or High Fanaa.
Then we have change group, which is the ownership of our file, the group level, and then we have
change ownership, which is the ownership of the file at the user level, some of the commands we have
already covered and some of the commands we will be covering in this lesson.
So let's go to our Linux machine and go where these commands one by one.
And let's log into our machine.
We already have the last screen open.
Let's clear this out.
Where are we?
We are in that see when you type and hit, enter and then PWI.
Now you are back in your home directory.
Clear the page.
So this way you will start fresh.
Now, with the first commander we will be learning is DKP against CPI's a copy command.
You can find out by hitting man and keep this will tell you sepi copy files and directories.
So the way you could do it in Windows is you right.
Click on a file and you get the option of copy and then you go to another file, another directory or
another location and then right.
Click into the paste and Linux.
This is how it works.
We will let's look at our listing.
We have all these files.
So now we will copy the file called George and we will name it to a different name.
Let's say another character for show David and you hit Enter.
So this will tell you that Sepi space source, which is the George and the destination, which is the
David, you enter and then you do X minus L tr the the TR option will give you the newest file created
at the bottom you enter.
So the David file is created.
If you also notice the George file is still there and it created a file.
Copy the file George and rename it David.
We could also add something to the file is let's say Coke.
David Huddy.
Is.
Elaine's boyfriend.
And then I'll put to David and hit enter and how do you verify you, Dukat, David?
You'll see the contents in there.
That's what you do the copy for.
You could also do as you copy, David, and then you can copy it.
Not at this location where you are.
You copy some other location.
Let's say we wanted to copy into temp location.
So it is going to copy it is now going to remove that.
It will copy it to the temp directory to enter.
Do it myself.
Here you'll see it has the David copy.
The original copy here now will go to slash temp and then we will do this myself to the bottom to see
the file as they see the same file that we copied.
But it's in a different location and it is owned by me, owned by the same group as myself.
And it has the same number of bytes you could do, CAD and David, to see what's inside of the file.
So Vittor, if you are in the intemperately, if you want to go back to our homework, you just simply
type hit enter and you are back in your home directory, Ellesmere's Altura and that's what you have
your all the files.
That's about the copy.
You could practice that copy command by copying different files or different names, whichever names
that you like.
The next command we're going to learn is remove, let's create another file touch and we will create
a new file in Homer, Bart, Marge, Lisa, and we call another file UPU Apu is another character of
Simpsons family.
So we'll create this file called UPU and we'll do this myself.
TR and you'll see it created a file UPU.
And if you wanted to upend a file or add something to LFR, what he would do we do echo UPU is.
And Indian character.
In the show, right, so I'll put that to where PWR are, you were fired up who an indicate that's how
you do it now you want to remove this file now after certain times, you don't need it.
So what do you do?
You do are FPO.
H.O. simply is that hit enter and it's gone.
Let's try.
Let's make sure it's gone or not.
Yes.
See, there is no such file UPU in our directory because we removed it.
We could also remove a directory, but we'll cover that when its turn is going to come.
The next come in we have to learn is move now, move command actually move the file from one location
to another and also rename the file.
How does it work?
Let's call Lex and Superman.
There is this character, of course, this villain character Lex.
So let's see.
We have the Lex.
Yes, we have there.
We wanted to rename that to Luthor.
So lax last name was Luthor.
So let's try.
We wanted to change Luthor.
So how do we do it?
We do move LAX and this is of course the source.
And what's the destination name?
We want to give it to Luthor el you tr this is going to rename this file within the same directory hit
Enter Ellis myself tr and you, you see Luthor.
So this is how you rename it.
If you want to rename any other file you could do that or you wanted to create a different file, you
could do that.
Let's say we have this file called David and we wanted to change to the last name of course, which
is Move David to Pudi.
So that's his last name.
So we're moving David to the name Pudi Slaters mysel tr they change the name from David it to Pudi,
but it kept the content of their file, which was if you look at you'll see David Puttees, Elaine's
boyfriend.
So just change the name.
It didn't change the content.
Next one by the way.
Also to change the location is if you want to move Pudi from this location to a different location,
let's shift to temp.
It will move that file to a different location temp.
Now let's see, do we still have that file?
No, we don't.
Where did it go?
We moved it to temp.
So how do we know it moved to temp you into temp?
Let's Manaslu here.
See, this is the Putti file that you created.
Now let's move this back to more PUDI back to our home directory and what is our home directory?
You guys should know that home your username and hit enter it should bring you back to the your home
directly.
When you do hit enter it will bring you back to your home directory to address myself to your annual
profile.
The next one is make directory.
It simply will make it mkdir.
Game of Thrones, one of the biggest shows that we created this.
This is how the new director is created.
Make DVR now.
Let's try command, which is remove territory.
So remove directory.
If you want to delete one of these directories from your from your home directory, let's say I want
to remove Game of Thrones directory.
You just simply type our MDI are and Game of Thrones.
And it is gone.
This is one way to remove it.
Another way to remove it in order for us to remove it, let's recreate it again, hit up our key and
you will get back to the same command, make the Game of Thrones.
The directors created another way to remove it is R.M. Dasch or Game of Thrones.
And it has gone.
All right, next come we have changed, group changing group is changing the ownership of the file.
Changing the ownership of a group of a file and the last command is changing the ownership of a file.
So if I wanted to change the ownership of file PUDI and I wanted to change it to a group called Root.
So we will do change ERP Route 30.
It's his operation not permitted.
Why?
Because we are we are ourselves and who can make these changes?
If I want to assign something to root, I have to be root.
So let's become root.
Once you are rude, let's go back to our home directory.
And now will do change grb route and purry, and this time it worked because we have all permissions
in the world we could think of.
Now next command change ownership to root of PUDI.
This will change the ownership of the file name Pudi to root as well.
Now, if you wanted to do both commands at once, the change owner you could do Afsal Colen Absol Pertti.
So what this command will do, it will change the ownership as well as group ownership of the file name
Pudi hit enter response here and there you go.
You got your file back with the original permissions or original ownership permission.
So these are the file maintenance command.
Once again, the recap sepi R.M. move mkdir remove Dyax Change Group change ownership.