My Profile Photo

Trevor Jones

My musings - interesting to me, hopefully will be for you

Using the terminal and figuring out Git

How to use the Terminal and Command Prompt.

Brand new to Git and Github? Not much experience with programming languages in general? Perfect! You’re in the right place. If you did lots of googling like I did to try and figure out Github and repositories, you probably found there weren’t many (if any) well documented tutorials to teach you the basics. If you don’t have a technical background it’s just hard to get started because everyone writes for a technical audience.

As mentioned in my about page, I’m learning to program/develop websites this summer in a coding bootcamp. We recently learned about Git, so I’d like to explain what I learned and hopefully help to translate it to those who don’t have a technical background, like myself. I tried to learn a lot of it on my own before my courses started and it was so confusing - hopefully my non-technical background will give me an advantage when trying to explain it. Lastly, this will be thorough, but if you really want to understand what’s going on, you need thorough. It’s broken up into parts, so take it step by step.

First off, don’t think of Git and Github as being the same thing - they’re NOT! That was my mistake in trying to figure things out. I tried learning both at the same time because I thought they were the same. But you need to understand Git before you can start using Github. And you need to understand your terminal (for Mac) or command prompt (for Windows) before you can start using Git (I’ll reference terminal from now on, but for Windows, think command prompt). So let’s do this - we’ll start off by learning about the terminal, then we’ll learn some about Git, then we’ll learn about Github. I strongly recommend you learn in that order as it will make the most sense.

The terminal is where we give commands to Git (don’t worry, we’ll go over what Git is if that’s what you’re looking for). It’s actually where we can give commands to our computer. You can tell it to make a folder, create a file, even put something in that file. So let’s open up our terminal. There are two tutorials below, click Mac for the terminal tutorial, and Windows for the command prompt tutorial.


Start by opening your terminal found in your Utilities folder which is found in your Applications folder. Then you should see something like this: Computer Name: ~ Username$" The ~ is your home folder. From here you can navigate to all the folders on your computer.

Want to see what’s all in your home directory? Type in “ls” and hit enter. These are all the folders/files you have immediate access to directly from the home folder. If you wanted to navigate to one of these folders, you can change your directory, or cd. So say you want to go to your desktop because there is a folder there you want to access. Type cd desktop. Now you have access to all folders on your desktop and you should see the word desktop right before Username$.

Type ls again to see what’s in here - either a lot or a little depending on how clean you like to keep your desktop.

Now we want to back out of the desktop and head back to the home folder. Just type in .. - yes that’s two periods. Then hit enter and you’re back in your home folder and should see ~ in place of desktop. Nice! You can go in as deep as you want into your folders by simply naming the folders with / in between, like so (using actual folder names): folder1/folder2/folder3

Now you have to use exact folder names, otherwise your computer won’t know where to go. And whichever folder you typed in last is the folder you’re currently in. You can tell by again typing in ls. If we want to back out of those three folders we navigated to, you just use cd ../../../ Use ../ for every folder you want to back out of (or just .. - but if you have two or more folders, you need a / between each).

Sweet! Now you can navigate in and out of all your folders. When we go over Git you’ll see why this is so important. You can do a couple other things within terminal such as create folders (mkdir foldername) or making files (touch filename. You don’t need to know those things for using Git, but if you want to learn more commands, check out this cheat sheet.


In Windows, use command prompt (click Start, type in command prompt in the search). There should be a little black window that says something like: C:\Users\Username (with your username). There? Good.

What you’re seeing when you first open the command prompt up is the directory to your home folder. Your computer stores everything in folders, starting with your root folder. Then you can build new folders and organize all the files you make. So the command prompt lets you navigate to all of those folders and files. The command (hence command prompt) you can give to change to a different folder is cd followed by the “folder-name”. cd stands for “Change directories”. Say we want to get to your desktop.

After your username, type in: cd desktop and then press enter. Now you’re in your desktop folder. If you want to check out what all is contained within your desktop folder, type in dir and press enter. (BTW - any time you want to execute a command, press enter. This will be a given from here on out).

Now you should see a list of all the folders and files immediately accessible from your desktop folder. We want to navigate to one of those folders. You should still see C:\Users\Username\desktop. To change to another folder, again type in cd folder-name. Now we’ve navigated to be inside that folder. This is important to note as any commands you give will only be given to folders/files within the directory that is showing in your command prompt (i.e. commands will only go to folders in your desktop if you were at C:\User\Username\desktop.

Now say you want to go back a folder. The command is .. - yes, those were two periods, that’s the command. So type in .. and now you should be back to your desktop.

And that’s how you navigate! Now, if you want to go two or more folders deep from your Username folder, you can do so. Just make sure you know the name of the folders first because your computer is dumb and can’t understand anything but exact commands. So type in cd folder1\folder2. All you need is a backslash between the folder names and you can navigate as deep as you want to go. Now if you’re four or five folders deep and want to come back out, you can do ..\..\..\..\. Type in two periods and backslash for every folder you want to go back to. Got it?

There are many other things you can do in here, but those things are unnecessary for our purposes. For now, it’s most important to know how to navigate between folders and see what is in those folders. If you want, you can check out this simple cheat sheet to learn more. But again, it’s not too incredibly necessary for using Git or Github.

All right! You should have finished either the terminal or the command prompt tutorials. Now that you are familiar with where you give commands to Git (and to your computer), let’s get started with Git! Go ahead to the Git tutorial

comments powered by Disqus