Let's create some new files
so
to create a new file,
I'm going to change the directory into mydir
just because it can be quicker to write commands
and
touch
is gonna create files.
So,
so if you just wanna create a file
without open, like in the previous video, in one of the previous videos
I showed you how to type
nano and then the name of the file and if the
file did mixes to and open it to create a new one
but if you just want to stay in terminal and don't want to go into a text editor,
you just want to create files, you'd use touch followed by the filename so
touch
and we're gonna create main.cpp.
So in the previous command,
let me clear this.
There.
So in the previous command we learned how to use the asterisk so if I were to
remove
this,
this would remove everything that has .cpp extension.
Let's say I actually wanted to remove everything but leave the directory intact
we would type this.
So let get out from this directory and I'll show you how it looks from the outside.
So if I wanted to remove everything about mydir
but leave mydir
existing, it would be written like this. If I run that and then run ls on
mydir we see it is empty. It doesn't have anything in it
so now we can remove
mydir.
Oh right sorry,
rm -rf mydir
so you need to use the -rf
to remove a directory.
And there we're back exactly where we started.
So
to recap on a few commands here and I'm just going to type them out,
cp is copy
the first argument takes
is the file
and
the second argument it takes
is where you're putting it and what filename.
So that's how to copy files.
How to remove files you just type rm
and then the filename.
Now let's say this is in the directoy.
You can still remove it you just
type the
the position of the file.
Then if you want to remove all file.anythings,
you do this.
If you want to remove all .txt files,
you do this.
If you want to remove every file from the directory you just do this.
It will remove everything from that and leave the directory.
If you want to remove the directory as well
that's everything in it,
you would run this command
and this is
rm -rf
and then the directory name.
Now if you want to move a file,
it's just like copy
except it doesn't leave a copy where it started
and so filename
and then where you're copying it to. Let's say you just want to copy it
at the same directory with a different name,
you would do this.
And we also learned the touch command.
So this you can create files
and stay in terminal
so that's, that's a neat command.
So thanks for watching.
What I want you guys to do
before you watch the next video, I want you guys to get used to moving around
in terminal.
So, use the commands that we've learned up to this point excluding the package commands,
just
use ls and cd and like
moving around the file system and go explore a bit.
Don't change permissions on any files you're not aware of
and don't change the ownership of them.
So,
really I'd recommend staying in the home directory at this point.
Just create some directories, move around in them,
create files, move files, copy files
and
get used to using terminal in this way.
It's gonna make future videos a lot easier
because I'm not going to go
slowly on them
and so I want you guys to be able to follow.
So thanks for watching and I'll see you guys next time.