Lesson Weekend

The first tool any new web developer must become comfortable with is something called the command line. No matter which language you program in, you'll use it constantly.

This lesson will walk through what the command line is, what it looks like, and how to access it. In the lesson following this one we'll learn how to interact with the command line by executing commands. Let's get started!

Graphical User Interface

We often access computer programs through their Graphical User Interface (or GUI, for short). This is simply the visual component of a computer program.

For instance, word processing software (Microsoft Word, Google Docs, etc.) generally offers a GUI with whitespace to type in, a cursor to indicate where we're typing, and a variety of buttons, menus, and options to format our text. This is a GUI. It's the visual portion of a program we see and interact with.

An email inbox that displays each email's subject line, allows us to open an email to see its contents by clicking on it, and offers buttons to reply and format text is another example of a GUI, or graphical user interface.

The Terminal

However, when we are developing code we often use our computer's terminal interface. The terminal is an area of the computer that allows us to do things (like create or delete a new file) with text-based commands, instead of by clicking options in a graphical user interface. These text-based commands are typed into something called a command line.

You have probably navigated through the folders and files on a computer using a GUI like Finder on a Mac, or Explore on Windows. In the next lesson we'll learn how to create, update, delete and navigate to folders and files using the text-based terminal instead. We'll also see how the terminal provides access to extra commands not available through a GUI.

Essentially, all you need to know right now is that a graphical user interface (GUI) allows users to interact with a computer through menus, buttons, and other visual options on the screen. The terminal, on the other hand, allows us to interact with a computer by typing text commands directly into the command line, which is housed in an area of the computer called the terminal.

Accessing the Terminal

Next, let's walk through how to access your own terminal and the command line it contains, so you can see how it works and what it looks like first hand.

Mac Setup

On a Mac, the terminal can be accessed by opening an application conveniently named Terminal. This application is located in the Utilities folder within your Applications folder.

You may also locate the Terminal program by clicking the magnifying glass icon at the upper right corner of the screen and typing "Terminal".

Open your own Terminal using either of these two methods now.

Windows Setup

Windows has a terminal program too. But unfortunately the version that comes installed on machines by default doesn't actually have all the capabilities we'll require. However, we can easily download and install a new terminal program that fits our needs.

There are many options available, but we recommend using a free program called Git Bash.

Download and install Git Bash at msysgit.github.io, and open your new Terminal program before continuing.

The Prompt

When you first open the terminal, you should see a short snippet of text followed by a grey or blinking rectangle. This rectangle is your cursor. Where the cursor is located is the command line. The command line is where we will type and execute our text commands.

The snippet of text left of the cursor is the command line prompt. It contains brief contextual information, such as the user account you're logged into the computer with, and your current location.

For instance, the prompts on Epicodus computers look something like this:

epicodus-5:~ Guest$

In the example above:

  • epicodus-5 is the nickname of the computer we're using.

  • ~ denotes that our current location is the home directory. (In programming, the ~ symbol usually refers to 'home'.)

  • Guest informs us we're logged into an account named Guest.

  • This is all followed by a dollar sign $. This symbol denotes the end of the prompt and the beginning of the command line.

Not all prompts look the exact same. Depending on the names of your machine and the name of your user account, your own command line prompt will differ. So don't worry if yours appears different from examples here; that's completely normal.

For example, if our computer's name was "school-machine", and our account on that computer was named "Jenny", we'd see something like this instead:

school-machine:~ Jenny$

Command Notation

When command line commands are written; whether here in our curriculum, or in other resources, they are often preceded by a $. This means the command is meant to be executed in the command line. The dollar sign is the common notation to communicate this because, as we just learned, most terminals display a dollar sign $ at the end of their prompt, like this: epicodus-5:~ Guest$.

When you see this symbol preceding a command in one of our lessons, know that you are not required to literally type a dollar sign into the command line. You will only type the command listed after the dollar sign. The dollar sign simply denotes that the command is meant to be executed in the command line.

Great! Now that we understand the basics of the terminal and command line, let's practice. In the next lesson we'll learn about the most frequently-used commands, how and when to execute them, and what they allow us to do.

Terminology


  • Graphical User Interface (GUI): An interface that allows users to interact with the computer through graphics and buttons and other visual, dynamic options.

  • The Terminal: The area or program in our computer that allows us to access the command line.

  • Command Line: A text-based interface that allows users to interact with the computer by entering text commands at a prompt. Also known as the terminal interface.

  • Terminal Interface: Another name for the command line.

  • Prompt: The portion of text that precedes the cursor in the command line. It provides contextual information, including the account you're currently logged into the computer with, and your current location in your computer's directories. The prompt and command line are separated by a $ symbol.

Tips


  • When you see this symbol preceding a command, know that you are not required to literally type a dollar sign into the command line. You will only type the command listed after the dollar sign. The dollar sign simply denotes that the command is meant to be executed in the command line.

Overview


  • A graphical user interface (GUI) allows users to interact with a computer through menus, buttons, and other options we can see on the screen. The terminal, on the other hand, allows us to interact with a computer by typing text-only commands directly into the command line.