Making Folders and Files with the Command Line

Fundamentals · Lesson 5 · 3 minutes

- Hey, what's up?
So, so far we've just been kind of moving around
on the computer and now
we're going to make some files and folders.
So the way you're gonna want to do that
is we're gonna come into a terminal here.
Now, first things first
if you're ever in your terminal
and you don't know where you are
of course you could do LS
and that will tell you
kind of the folders that you're seeing.
You can also do this command.
So a new command to learn is PWD.
And that's going to show you your path of where you are.
So you can see I'm in users/castig
and what that represents here on my computer here
is users/castig like this.
It'll take some getting used to
but that's more or less what that means.
So if at any point you did get lost
you could always do PWD
and that's going to tell you where you are.
This castig here is, it's like the root
meaning like the kind of beginning of
all your things that you're seeing.
What I mean by that is
we have castig and then my desktop
is actually part of that file structure there.
You can see within castig I have the desktop
and I can show that same thing here
within castig which is basically my route, my beginning
I have a desktop there as well.
We've done that already.
Okay, so what you're gonna wanna do
is go to your desktop, so you can do
CD desktop, like that
now I'm on the desktop.
And to create a file,
you do touch and then whatever the name of the file is.
So when we do something like, touch hello
It's gonna just create this file here.
Hello - it's just a basic file.
You can see it made that there.
The cool thing is, you can create a file
of any language, I could do
touch index.html
index.html
and it's going to create an index
an HTML file with the name of Index.
Similarly I can create a .RB file
for Ruby file,
a Pthyon file, all these kind of things
are available to us,
just by using the touch command
and the name of the file.
Pretty sweet.
I can also create folders,
so another command that's worth knowing
is MKDIR make directory.
Make directory, and I can call this my project
make directory in the name
and you'll see it'll make me a folder.
So again, these are things that you do
already with the mouse.
You create new folders,
you create new files.
We're doing it step by step
so you can see the power when we do the scale
and we do it many times.
So these are the commands,
and I'll put these down below for you.
If at any point you're using
the command line and you wanna get back
to the route, to where you started
and you're like,
I don't know where I am, I got confused.
A few things, you can always just type CD
by itself, and it will just
go to the route, okay?
Or, you could always just close it out
and start again, and it's gonna just
bring you back to the route again.
Don't worry about what this first line is,
last logged in, whatever.
I don't ever pay attention to that.
But just know that when you start over,
close it, start a new one,
you can start afresh.
So if at any point you do get lost,
you can just do that.