Day 23

What is a terminal, and why should I care?

Not knowing how to use a terminal would be like a writer not knowing how to use a computer; sure they could use a typewriter or good-old pen and paper, but how effective would they be?

 

This post is part of the series 30 Days of Web Development.

In this series, we start from the basics and walk through everything you need to know to get started with Web Development.

What is a terminal, and why should I care?

Not knowing how to use a terminal would be like a writer not knowing how to use a computer; sure they could use a typewriter or good-old pen and paper, but how effective would they be?

The terminal is a program that you use to type in commands. It is a text input/output environment. In this article, we'll cover what a terminal is, introduce you to a couple of useful commands, and talk briefly about what commands are.

Opening the terminal

The default terminal is usually white, but you've probably seen black terminals in movies. Featuring a geeky hoodied-hacker doing something like "running an algorithm" or "extinguishing the override" or some other nerd'ish lingo nonsense. Take, for example, the terminal making an appearance in these well-known movies:

From left to right, these images are from Girl With The Dragon Tattoo, The Fifth Estate, Snowden, and The Matrix.

Let's start things off by opening your terminal; every major computer comes packaged with a terminal program.

Exercise: Opening the terminal

  1. macOS Users: There are several ways to open the Terminal on a Mac. I will use Spotlight. To use Spotlight, press cmd + spacebar. Then type in "terminal". You should see the Terminal application come up. Click on it.

When talking about the actual Terminal application that comes packaged with macOS I'll capitalize the "T." Otherwise, terminal with a lowercase "t" will refer to any terminal program that interfaces with your Shell. Thus, I can use the lower case terminal to generically talk about both the macOS Terminal application and the Windows OS Powershell.

  1. Windows OS Users: The dominant Shell-CLI environment for Windows 10 users is PowerShell. To navigate to PowerShell, search for the "PowerShell" in the File Explorer and open it up.

Before we start typing commands into the terminal, let's chat briefly about what commands are.

Commands

As we'll learn more about in tomorrow's article, the terminal works with the Shell of your computer. If you remember from Day 3, the Shell wraps around your computer's Operating System, or more specifically, your Operating System's kernel.

Shells take commands, process them, and then do something in response. For example, when you make a folder on your computer, you are using a program that, like the terminal, commanded your computer's Shell to make a folder. The Shell communicated with the computer's kernel to do as you asked.

The terminal is similar, but instead of clicking on menus to make a folder, you type those commands. For example, making a folder can be done using the following command inside the terminal:

mkdir

mkdir stands for "Make Directory."

Here's what it looks like using the macOS Terminal application to "Make a Directory" called newFolder on my Desktop.

When you run the terminal, you are issuing commands directly to the Shell. You may see a $ when you open the terminal program. The $ is Shell's symbol for indicating that it's ready to take a command.

Now, if I look at my Desktop using my Finder program, I'll see the folder called "newFolder."

Folder and Directory essentially mean the same thing. "Directory" is a classical term used when Shells and terminal programs were being developed. "Folder" is a more visual word that came about as Finder and File Explorer programs came into existence. Technically, a Directory maps to a file system, whereas Folder is a less specific term. Because the Shell programs are older, they tend to always use Directory instead of Folder, e.g., mkdir make directory.

Exercise: Shell command practice

  1. Download the shell-script-practice.sh file to your downloads folder on your computer.

  2. If you'd like to peak, go ahead and open this file with your text editor. The code you see is written in the Bash Scripting language; a programming language that works with the Bash Shell. The Bash Shell is the default Shell that comes with macOS.

 

This page is a preview of Your First 30 Days of Web Development

Get the rest of this chapter and 180+ pages of Web Development instruction for free.

The entire source code for this tutorial series can be found in the GitHub repo, which includes all the styles and code samples.

If at any point you feel stuck, have further questions, feel free to reach out to us by:

Get started now

Join us on our 30-day journey in Web Development. Learn the basics of HTML, JavaScript, the Terminal and start your journey to becoming a web developer

No spam ever. Easy to unsubscribe.