A big part of being a developer is being able to use the terminal or the command line.
Well, what is it?
And this video, we're going to tackle this question and teach you a couple of very useful commands.
Now, on a mac, you simply do command space and type in terminal press enter and then the terminal
will open for you.
It's one of your applications and it's on every computer.
If you're on a Windows machine, then it is the command prompt.
But what is it?
Well, it's how humans originally communicated with computers.
Up until the 1980s.
It was the main way humans gave instructions to computers.
And computers gave output to the humans.
We didn't have something called the gooey or the graphical user interface, such as me opening up a
new folder and changing the name of this folder or opening up Google Chrome.
I don't really need to know how this is done behind the scenes.
I just click on an icon and it opens it up magically for me.
But command lines are really useful because you can do the exact same thing that you do visually on
a graphical user interface like I have here on the command line.
But they tend to be much, much faster to do as I'm going to show you in this video.
And they're also common ways to access different computers around the world.
Like if you need to access a server in another country where your Web app is hosted.
Well, you would use the command line and I'll show you how to do that later on in the course.
Now in your day to day job, you'll be using the terminal a lot because you'll have to access servers,
the database, your front end application.
But you can do all of that in one from the terminal.
You can also download scripts that other people have written from the Internet so you can use in your
projects.
Now, these are all things I'm going to show you in the later sections.
The commands that I'm about to show you work on a mac or a Linux for Windows.
I'll have the Windows version command at the bottom of the video as we progress.
Most of them are the same, but there are a few differences.
So let's get started.
The first command I'm going to show you is the RLS command.
I simply type in and press enter and it lists everything that is in my current directory.
What is my current directory?
Well, I do p for present working directory and I see that I'm in the users.
That's my username.
So I'm in my username folder and these are all the things available to me.
If I do CDD, then I can go into this.
If I wanted to go to let's say desktop, I do CD.
Desktop.
And now if I do LRS, I see that I have untitled folder because that's the only thing on my desktop
right now.
I can also do seed, dot, dot.
And this brings me back to one directory up.
I can also do clear to clear up my terminal.
And have a nice, fresh slate.
The Circle Man CD slash and this takes me to the root directory if I do ls I see that I have applications
library system users that's the root directory of my Mac essentially my macintosh HD.
I can also do CD.
Squiggly line, and this takes me to the user directory.
Let's clear this again.
And if we check where we are.
All right, let's change this untitled folder to something like test.
Okay.
Let's say I'm in the user directory right now.
I want to access desktop and then the test folder.
I would simply do CD desktop and then test.
And now.
I'm in the test folder, but there's nothing in there.
So one thing we can do is I can say open.
DOT and it opens a folder that we're currently in.
Okay.
We're in the test folder now.
If I just put this to the side over here so you can see, I can say.
Make directory, which is make a folder name.
So name here will be whatever I want the folder to be titled.
Let's just say this folder would be called.
Web app.
Do you see that now?
Web app shows up in my folder.
Let's change of view here so you can see it better.
There you go.
If I do, LZ, now I see that we have the Web app folder and as we know, we can go into it.
And let's double click here to see what we have.
We have absolutely nothing.
Well, we can create a file in here by saying touch and the name of the file.
So let's just do index HTML.
There you go.
Next.
Hmm.
Now, what if we wanted to open this index.html again?
We just do open, and the dot means we open the folder we're currently in, which is here.
But if I do open index dot html.
It opens the file for us.
How cool is that?
But index site HTML is pretty empty right now.
Wouldn't it be nice if we can open sublime text from here and add something?
Again.
You can do that with open.
You put in a sew line a for application and the name of the application so sublime text.
Close the double quotes.
Press enter.
And look at that.
I have sublime text, but if we wanted to do application sublime text and open the index HTML file.
We just do this?
And now I can say HTML and we'll just say hello world.
Save that.
And if I do open index html.
We have our index.html file loaded.
Wasn't that a lot faster than right clicking, creating a folder then dragging everything to sublime
text.
And as you can see, you can do things really, really fast here.
Okay, let's change something.
Let's I'm going to close Google Chrome and Sublime.
And in the web app, let's say I wanted to change the name of indexed HTML to above that HTML.
Well, I'll do the MV command which stands for MOVE, but it just moves the indexed HTML file to about
HTML file.
So it's a little trick.
You're essentially just moving one file to another, but by changing the name, you create a new file
and you replace it with the old one.
So now I have about dot html.
Very cool.
Now these commands typing them can get pretty tiring.
Again, press the up arrow.
And it goes through my entire history.
Which is very cool.
I can also press the tap key and it will bring up.
My most recent command are complete.
So what I'm about to write so you can do it really, really fast.
And when your commands get longer and longer, it's a very useful thing to do.
Okay.
I don't really need the about html file anymore.
Let's remove it.
We do r m for remove and the name of the file about.
Oops.
About HTML.
It's been removed.
Perfect.
Now, what about the web app file?
We can remove that as well.
But if I just do remove web app.
Well.
It's not going to work.
First of all, if I do ldrs or present working directory, I mean the web app folder.
So I need to move back to the test folder.
Let's clear here.
Do see.
Now my present working directory is I'm in the test so I can remove web app by doing remove web app.
But Ram only works for files to remove a directory folder.
You need to do them and then use the R option.
And then the folder name and our case.
It's the web app.
There you go.
It's gone.
And with that, you know what?
We can remove the test folder as well.
We can go back to our desktop and then do remove our.
Test.
There you go.
It's gone.
And one last trick on a mac.
You can do this.
This is so cool, right?
Very, very cool.
Okay.
As you can see, you can have a lot of power with the terminal.
And I want you to get used to writing commands on here.
And from now on, try creating files and folders this way.
Eventually you will get more and more comfortable with it, and things will be much faster than just
using the guy in the developer environment section.
I'll show you how you can change this boring black and white terminal to something like this.
That's it for now.
See you in the next video.
Buh bye.