Hello in this venue we will learn how to rename files and how to physically move files.
So right now I'll go to my desktop and I'll make a list just.
This will show me all the files including hidden files and of course I have here nothing except my two
special directories which are the current directory and the parent directory as you know they are present
underneath any directory in our file system.
So let's make a new file I'll call it one too.
And inside of this file I will say I like aboon too.
And of course I love Ubuntu.
So right now what if you want to rename Ubuntu into another name.
So this file you're going to I want to rename it for example to Fedora.
This is very simple.
All you need to do is just say envy your all the file name and then you specify your new filename.
So in this case I want to rename one to two fedora.
And here you go.
Now the file is renamed to Fedora.
And if you open up Fedora you will have the same content which is I like Ubuntu.
So MVR stands for move and you can use it both to rename files and you can also use it to physically
move files.
But right now we focus on renaming.
OK.
And do you remember.
I actually know what I want to rename it back to open too.
So I would say move Fedora aboon to M.V. perfect.
So we are we mentioned before that any hidden file begins with a dot and if any hidden file name begins
with one dot.
Right.
So if I want to make up into a hidden file all I need to do is say M.V. Kubuntu and then I will have
to specify my new name.
But I have to include one dot in the beginning to make it hidden.
So my new file name will be open to the one before and but this one will be hidden because I have one
dot in my name beginning with one dot.
So if I could just this will make it hidden it will not delete it and if I want to confirm that al-Sayed
l dash OK.
And as you can see my file is here.
So if I want to bring it back to life I will say that I want to and my new file name I will just remove
the dot from the beginning of the file name and this will bring it back to life.
I'll clear my my screen here as you can see we want to come back to life.
So now it's visible again.
So in general if you have a file name and you want to make it hidden You just have to put one dot inside
your new file name.
And if you have a hidden file
which begins with one dot of course all you need to do is just just you know remove any DOT beginning
any dot from the beginning of the file.
Perfect.
So right now we know how to rename files and how to make a file hidden and how to make a hidden file
visible.
Perfect.
So let's proceed from here.
Let's make another directory or directory we call directory one and let's say for example I want to
move one to two directory one.
I want to physically move the file one to two directory one.
So what do I mean by physically move it.
I mean that I don't just want to copy it inside.
I just want to put it inside directory 1 so 1 2 will not be longer on my desktop.
And I guess for Windows users they are used to the word cut.
You would say I want to cut the file into two directory one and put it inside directly one.
You can also achieve this with the M.V. command your remove command and in general if you have more
than one file like file one file to file three that you have many files that you want and then you have
to move them into a destination folder.
So this is how you can move files.
So in this case I have one too.
And I want to move it inside of directory one.
This will do the trick.
So if I open now directly one I have my file one too.
And of course one two is no longer exist under.
In my desktop.
Perfect.
And let's do this one more time with more than one file.
So I have filed one file to file three and they want to move all the three files to directory 1.
So I will say in the file one file two and file three and put them inside directory 1
or No such file or directory of course because there is no file here.
I have to say file one.
So this this this actually moved the file to an file 3 but it did not move file 1 because I made a typo
error here.
I did not say file one.
I just save files.
So if I save file one directory one this will do it.
OK.
Perfect.
So now inside of my directly one I have all these three files.
Awesome.
And let's make another thing here so let's make F1 F2 F3.
And here I'll show you one saying If you want to move this refiled F1 F2 F3 to the rectory 10.
This will tell you an error here.
I cannot move these files in the directory and go directly to and does not exist.
So if you specify a directory which does not exist this thing of course will not work.
So this is just I will show you that you have to specify a target or a destination directory which exists
already.
Perfect.
I actually want.
OK so now you know how to move files to directories.
What about moving directories to another directory.
So if I have the to hear actually you know what that's delayed F1 F2 F3.
OK so now right now I have two directories directory one and directory too.
OK.
Before I actually would know how to move the directory to another directory first I would just want
to tell you that you can that you can rename a directory the same way that you can redeem a file.
So if I want to rename directory to and I want to go for example directory 22 this will do the trick.
This will rename the directory to two directory 22.
So for example if I have a touch I make a file inside of directory 22 I'll call it hello.
Right now inside of directory 22 I have hello and I want to rename directory Twenty-Two to directory.
Again this will just do a renaming and the file hello will or will still exist.
So you can rename a directory the same way that you can rename a file.
Perfect.
But now if you want to move a directory into another directory physically move it then you just say
M.V. directory that your directory name and then your destination directory the same exact way.
So I want to move directly to to directory 1 and this will do it.
I can see directly to those no longer exist here.
And if I open directory one you would see directory 2 inside.
So every command is very easy.
You don't need to use the dash or option.
You don't need to use the dash option that we used with the r.m command and with the C-p command which
makes life easier when you use the M.V. command you have fewer options.
Okay perfect Let's OK.
So right now we are done with the MBA command but we have to mention one command option that you can
use with the M-B command which is the dash.
And that's the same like the C.P. command is the interactor which is also the same as the air or in
command.
So if you have a file one here so file one on my desktop and of course as you as you may remember I
have another file one here in my directory one and both like both of these files are empty file one
here is empty and file one here is empty.
So let's say Here I will say I like when two and I want to overwrite file one on my desktop to file
one on my directory one I want overwrite.
So all I need to do is just say in the file 1 and then move it to directory one.
So if I used the dash I option as you may remember from the C.P command it will ask for your confirmation.
Do you want to overwrite the file.
I would say yes and this will this will move the file though it will not copy it because we're dealing
here with the command.
So it moved as a file one from desktop and it overwrites the file which is in my directory.
And of course he would see the line I like wouldn't too.
If he did not use the dash i option it will not ask for your confirmation message when overwriting.
This is the only difference to dash I will display a confirmation like that it will ask for confirmation
but without specifying the dash I it will overwrite without your permission or without your confirmation.
So that's it for this video.
So let's do a very quick summary if you want to rename a file.
So if you want if you want to rename file one to file to your just say file one file to if you want
to rename directory one into the directory to will just say directly or indirectly to of course.
I assume here that the does not exist because if it existed this will move directly one inside of the
directory to the like just to be aware of that right.
If you want to make file one hidden you will just say file one file one if you want to make that file
one visible You will save for that file one file one and so on.
You know so that's it for the M.V. command.
I hope you enjoyed it and now you can now you know many things you know how to remove files you know
how to copy files how to move and rename you know old bunch of stuff.
So right now we learned enough commands that you are kind of comfortable to work with the command line
and from the next videos you'll learn much more and you will one day you will be a command line master.
Until then I'll see you sow.