Everyone thanks for joining me again, in this video we're going to be
covering a few more utility commands
and then we're gonna move on to more advanced stuff.
So, we already know how to use the following commands
and also,
switch user.
These are utility commands I'm not gonna,
I'm not gonna thrill the
repository commands and package
installation commands in here.
These are the utilities commands that we can currently use and this gives us
the ability to move around the file system in the terminal, to put things out,
to modify some things in terms of file permissions
but we, we have a few more things to do.
So,
let's start by listing
this
directories contents.
So let's look at the, the a.out file.
Let's say I
wanna move that.
Just want to move it somewhere.
So,
how we do that is we will first create a folder.
So this is the first command we're gonna learn here
it's mkdir
and this is an abbreviation for make directory.
It's going to be followed by the directory that we want to create so again we can
use an absolute position if I wanted to put it user
bin and then my directory
this would create an absolutely positioned directory.
We can
go one level up
or two levels up
and then create the directory
or we can just say in the current directory create
newDirectory.
Then if I run ls again,
we can see
newDirectory
right here.
So let's move a.out
into newDirectory.
So to do this, your gonna type mv
in the said abbreviation for move
a.out newDirectory/a.out
and what this is gonna do is this is going to take
this file
which is found in the current directory
move it into newDirectory/ the same name and we do need to provide
the name
and then hit enter.
Now if we run ls again,
we see that a.out is no longer in the home directory
but if we run ls
on the newDirectory,
we could see it's in there.
So that's how to move
files. Now let's say we want to
copy it somewhere else
so,
I have a directory that I created in the previous video called mydir.
Let's
rename that.
So to rename it,
you use the mv command.
Then if I run ls again,
we're gonna see we no longer have a mydir
but we have a mySecondDirectory.
So let's copy
the a.out file from newDirectory into mySecondDirectory
and how we do this is with a command called cp
which is an abbreviation for copy
and the first
argument we're gonna give it is what file we want to work with
and then the second argument is gonna be where we wanna copy it to.
So,
newDirectory/a.out
and then mySecondDirectory/a.out and hit enter.
Now if we run ls on my
Second
Directory,
we got this.
We've got file and file2 from the previous videos but now we've also got a.out
and if we
list the
newDirectory
we also have a.out so now we've got two copies of that file
which is awesome.