Hello everyone.
In this demo, I'm going to show you how to use CP Command and MV Command.
CP Command copies, files and directories.
For example, if I would like to copy this text file if one dot txt to directory one.
So I'm going to type CP, then the name of the text file if one dot txt then the name of the directory.
Now I'm going to check if I do have the text file inside this directory.
Yep.
I do have if one dot txt.
If I would like to copy a directory to another directory.
So cp then I have to add the option dash r.
So this is for the recursive in case if we have subdirectories inside directory two to directory one.
Let's check it out.
Now.
You can see here, as we can see here on the screen, I have the to inside directory one in case if
I would like to copy the content of any text file.
For example, here we have the content here.
One, two, three.
Inside the text file f1 dot txt.
Let's check.
Text file to the f2 dot txt.
We don't have any content there so I'm going to use the cp f1 dot txt.
Then f2.
So what I'm going to do, I'm going to copy the content of text f1 dot txt to f2.
Let's check f2 now.
Perfect.
Now as you can see here in the screen we have one, two, three.
If I would like to copy multiple files, for example F2 and F3 to a directory directory one let's check
directory one right now.
As we can see here, we have text file, the F2, the txt and f3, the txt.
If I would like to copy
more than one directory, for example, I would like to copy the directory three and four to directory
one.
So I'm going to type KB and we don't have to forget the dash order recursive in case if there is any
subdirectories inside this directory.
So then directory three and directory four.
So we're going to copy this to directory three and four to directory one.
Let's check directory one right now, as we can see here, we have directory three and four.
If I would like to find more information about this command KB, we can go to the man page, we can
find more details and also the options.
That we can use.
You use them with the.
With the command.
Okay, Let's go back.
Now let's move on to the next command.
The env command.
If we would like to find more information about this command, we can go to the man page.
So this command, the env command.
Moves are renames names of files and directories.
And we can see here here the options that we can use with the command.
Let's go back and do some examples.
So I would like to move.
If one.
The txt to directory box.
So i'm going to type env.
F one.
TXT two.
Box one.
Go to box.
So then I'm going to hit enter.
I'm going to check right now that directory box.
As we can see here, we have the F1 dot txt.
Let's double check here.
And under the home directory right now we don't have F1 that text anymore in the current directory.
Now if I would like to move multiple files for example, if two, three and four.
Same thing.
So mv f2 then f3 and F4 to directory box.
Okay.
Let's check right now and box.
As we can see here we have.
Text file two, three and four.
Let's check right now the current directory.
As we can see here, we don't have all these text files.
If I would like to move a directory so I'm going to type env, then I'm going to move directory one
to box.
So I'm going to type directory one.
Then box.
LS dash L.
Then I'm going to go to this directory.
As we can see here we have directory one and right now here in the current directory we don't have directory
one right now here in this current directory, if I would like to move more than one directory.
So what I'm going to do, I'm going to do the same thing.
Envy then, for example, directory to.
Then directory three.
Then directory 422 box.
So let's check right now the directory box.
As we can see here, we have directory two, three and four.
Let's check right now the current directory so we don't have directory two and three and four.
If I would like to rename for example the text file here.
So I'm going to use the same command mv.
And the text text then text.txt.
Then I'm going to call this one file dot txt.
Let's check right now.
As you can see here, so we change the name to file dot txt.
If I would like to change the name of any directory will be the same thing.
For example box.
I'm going to use env box to call this one directory.
Perfect.
Dash l.
As we can see here, we change the name of the directory from box to directory.
That's it for this session.
Thank you and see you in the next lesson.