- Hello, this is part 5, or actually part 5A
of my Git and GitHub tutorial series.
I'm taking a break in this particular video
of focusing on Git concepts through the use
of the GitHub website to talk about something called
terminal and shell commands and terminal prompt
and Unix and that sort of thing.
So why am I talking about this?
The goals of this video series now that we've covered
basic Git and GitHub concepts is for you
to work locally on your laptop to work with Git offline,
not through the GitHub website
and that's going to be very useful for a variety of reasons
that you will see as I get through these various tutorials.
Now, here's the thing, how do you do that?
I am using the Mac computer system operating system
snow tiger leopard something or other,
making the same joke I made 10 minutes ago
but you don't know that I'm doing that
and I shouldn't have done that but I did it anyway
and it was better the first time but I got to keep going.
So I'm using this, someone will edit that out.
I'm using this Apple operating system
and so I could download software that allows me
to run Git through a visual interface
but the way that I work with Git is by typing
in Git commands to a terminal prompt
and this, if I can bring this up, is what a terminal prompt
looks like and this is what a command looks like.
Draw a circle!
Of course, that's not a valid command.
If I hit enter, it's going to say -bash: Draw:
command not found.
So what is this bash, what is this terminal?
This is actually emulating, this is the types
of commands I'm typing in here are the same commands
I would type to a Unix operating system.
So this is Mac OS
ZYX.
You might be using Windows.
Unix is another operating system that is
you entirely interface with through the command line.
So if you want to do the stuff that I'm going to show you
in this video on the Mac, you want to open up terminal,
if you're opening up terminal for the very first time,
that's very exciting.
You can find it by even just going in and searching
for terminal, you can see there it is.
But it is in applications/utilities as well.
If you are on Windows, I would suggest that you download
something called Git Bash which I'll include a link
to downloading that in this video's description.
You can actually use our various shell prompts
in Windows and I believe that Unix shells
are coming to Windows natively perhaps in the future
or by the time you're watching this video,
maybe they're already there but Git Bash
I know will work if you're following along
the stuff that I'm doing in this particular video.
Okay so what I need to show you now are what are
the basic commands that you might want to type here?
Maybe there's a command called help.
There is.
So you can see that there's lots of things
you can just come up with, type something,
see what happens and this is a huge topic,
I could make 100 videos probably about things you could do,
Unix command prompt.
One that I'm going to show you right now is you can type clear
and it just clears you right back up to the top
which is nice to sort of clear what's been
on your screen previously but I'm going to make a list
over here, the main thing that you want to do,
learn before you go on to the next video and again,
if you've already, if you know about Unix shell commands,
you can just skip ahead to the next video
is working with your file system.
So the main way to work with your file system
is actually one single command called cd,
change directory, just like you might double click
on a folder through the interface, cd is like changing
the directory that your command line prompt
is currently actively associated with.
There's also the command which I use a lot called pwd,
print working directory and then there
is also the command ls which lists, lists,
the contents of the current working directory.
So these are essentially the main ones that you want to use.
We saw clear, I'll probably as I start doing stuff
by accident use a few other commands
but let's just get comfortable with these basic commands
before we move on to executing all the git commands
in terminal as well.
I'm coming back over here and now I'm going to just start
by typing in my first command.
My first command is going to be pwd.
There it goes, oh, whoa, I'm in a weird place.
Ah, clear, I'm going to do cd.. clear so pretend
that didn't happen, I forgot I was demonstrating
something earlier but you might have gotten
a little bit of taste there
but I'm going to correct that, scratch that, edit that out,
it won't be edited out probably but I'm going to type pwd.
Pwd, look, here I am in Users/processing
so this is the default directory that terminal
just sort of set me in originally.
I can actually open this directory directly
in the finder by saying open., open, the dot being
this current directory, open meaning opening.
So if I wanted to open a file, I could actually put
the filename in here but I want to just open
this directory and you can see now in the finder window
what are the directories here, applications,
desktop, documents, downloads.
If I were to now type ls, list, you can see, look,
it's listing all of those here in terminal prompt.
So this is just another interface to your file system,
the same way the finder on the Mac
and the explorer on Windows is.
So let's say I want to put some stuff on,
work with some files on my desktop.
I would type cd Desktopp and I'm going to misspell it
with two Ps and it should say,
"No such file or directory exists."
If I spell it correctly, I should be there now.
I didn't get any message but I could say pwd
and you can see now I have changed to the desktop.
Now, I'm going to show you a little trick.
First of all, let's say I want to go back a directory.
.. will get me back a directory so if I do cd..,
now I'm up one directory and I can see that for sure,
/Users/processing.
Now let's say I want to change to the desktop
but I don't really feel like typing so much.
If I type cd Des, I'm going to hit a magical key now,
tab is a magical key in the command line,
and what it's going to do, it's going to fill in
the rest of that, now how did it know
that I intended to type desktop?
Well there's only so many things,
there's only so many options, there's only one
that starts with De, desktop, so tab is a way
of auto filling in a filename and I'm going to use that
a lot as I do all sorts of stuff in git,
hitting tab to auto fill in, that's a quick way
of doing things so now I'm on the desktop again.
Another trick is the up arrow, up and down arrow allows you
to browse through previous commands so you can see here
I'm hitting the up arrow so if I wanted to find
a command like this, I could just find it again,
hit enter and now I opened my desktop
and you can see, these are the various files
that I have on my desktop and you can see I actually have,
this is foreshadowing, this is a narrative device
called foreshadowing, I have this Rainbow-Poem folder
which is actually my git repository that I downloaded
from GitHub which I'll get to in the next video
more about that.
Okay I'm trying to think, ah, here's something else
that you really want to do.
So let's say you want to activate a current directory
in terminal that is somewhere deep in your computer.
So I'm going to go back to the finder and I'm going to go
to documents and I'm going to find data APIs, JSON3.
So this is some old example that I made
in some previous video tutorial.
Let's say I wanted terminal to point to that directory.
Well it's /Documents/data_APIs/ so a lot to remember.
So something that I can do is I can type cd space
and now I can just take this folder and drag it
into the terminal window and let go and you can see
it's going to auto fill in the path so I can now hit enter,
I can say pwd, I can say ls and I can see that now.
One thing I'll show you about ls that sometimes I need
is I can also do ls -all so Unix commands
can be often modified with arguments.
This is one argument, -all, which will give me
more information about those files and you can see
it's giving me information about,
this is file permissions, the date, the size,
which user has control over this file,
all that sort of stuff so you know, in this case,
hidden files will show up this way,
that's not something you're going to need all the time
but it is particularly, can be rather useful.
So this is the basics, this is all I really need to do
because ultimately if I want to execute git commands
with a particular set of files, I just need my terminal
to be in that directory so for example, if the directory,
as I know, it will be and this is kind of going
into the next video, is this Rainbow-Poem folder
on the desktop, I will just want to type cd,
drag it over, hit enter, type pwd to confirm
and now you'll see, I am now ready to execute git commands
on the git repository that is in this Rainbow-Poem folder.
All right, so I hope you enjoyed this video
about basic Unix stuff that you need for doing git
and commands via the locally on your computer
and in the next video I'm going to move on
to actually showing you those git commands
and how they differ and how you work with GitHub
and all the stuff that I'm going to get to.
Okay, thanks again.