Hello and welcome to Command Line
Basics. In this video, we're going
to learn about Linux file commands.
Part one, I'm Christopher Haler.
And let's begin.
So we're learning objectives for
this video. We're going to learn the
C.p command and what entity
does understand with the R.M.
commandos.
These are all very important basic
file commands.
In order to be able to use the Shell
prÃ©cis, the R.M.
Command will not delete important
system files.
Is this true or false?
The answer is false.
The RMN will delete
important critical system files
if you tell it to, and
especially if you're running as root
and you tell it to delete important
files. It's not going to ask you
twice and it'll get through it.
So what's
unique about Linux is that it
will do exactly what you tell them
to and a computer will do exactly
what you tell them to.
So if you tell them you want to
delete some critical system files,
you want to ask twice, it'll do it
and you'll 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
take the time to know what these
outputs are going to be.
So we're going to start with the CPP
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 to 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 and work
with that file or say that you want
to copy a whole folder and send
that up to a share or share it with
someone else.
You can use that, a copy command,
the copy command.
So this is very useful and
you're going to end up using it a
lot.
So let's go into my Linux machine.
I'm going to see what kind
of items I have in
my folder.
And now let's say I want to
copy the load that to
file. And so I'm going
to type and
lo and push
to have for autocomplete and
say the new file
is going to be new.
Hello to
Steve
and I'm going to type again.
And as you can see, we have the new
text file in there now.
And let's say we want to look inside
of it to make sure everything is
just fine.
And look at that.
We have Hillo.
This didn't overwrite and that
was just the 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 we can use the dash are
to copy folders as well.
Now we have the move in the movie
Command.
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 want
to 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 to a
file share.
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 to just rename
a file.
Some Linux distributions don't come
with a rename command, but they
do all have the V Command.
So in order to change the file name,
you can just say and the the old
file name and then give it the brand
new file name that you want that
file to have and it'll move
the file, it'll make a copy of it
and then delete the old file so
you will have a new file name that
way,
give you a demonstration of this.
So let's say this new hello
t t file.
I want to change the file
name of it.
So I knew that.
And I'm going to say
new name
that T.
And look at that, we have new name
now, so this is a useful way
to rename files as well.
All right. And now we have our end
to remove files, to delete files.
So this is very important
because you're going to want to get
rid of some files if you don't need
them to free up space.
But you have to be very careful.
Like we were saying in the previous
segment, this is a way that you
can delete critical operating
system files as well.
And we have the dash
are in the dash F
for recursive and force
and recursive means is that
it will keep the leading things
down inside of some folders
inside of where you were working.
So it'll delete everything all the
way down until there's and then
nothing further.
And the the force, it will not
prompt you if you are sure
you want to delete that file or not.
So something you may see
online, as you may see somebody
telling you to remove the command
pseudo R.M.
dash, RF slash.
And what that does is it will
actually remove recursively
everything inside of the
root, the slash of your Linux
machine.
So this is kind of
a meme you'll see online.
Just don't do it.
It never ends well.
And I'll give you a quick
demonstration of the
R.M. come in.
So let's say we want to delete this
new name that.
So I'm going to type our
new name,
enter and
look at that. It is gone.
So even though we made a copy of
this file and we change the
file name for it, it's not our
problem anymore.
We didn't want to. We got rid of it.
All right. Post assessment, which
command can also be used to rename
files?
Is it A copy
B and the C
pseudo or D are
M?
The answer is B M.V.
This is the command that we can use
to rename files by
creating a copy of the file and then
deleting the original form.
The CPP command will leave
a copy of the original file.
The pseudo command is to run
commands as root, not necessarily
when we could run the command
with pseudo the command
by itself. We'll do what we need and
the ARM command is to remove or
delete files, not to rename
them
to. In this video we learned the CPP
command would, M.V.
does and understood the R and
Command and how to remove files
and I hope to see you in the next
video.