The command line, terminal, and shell

~9 min

Most people control a computer through visual elements such as icons, windows, buttons, and menus, and this type of interface is called a graphical user interface, commonly shortened to GUI.

Engineers also frequently use another kind of interface, a window containing text and a blinking cursor, where instead of clicking visual controls they type instructions called commands.

This way of interacting with a computer is called the command line.

What is the command line?

The Concept · lights on your mapcommand lineThe text-based way of giving instructions to a computer. You type a command, and the machine carries it out and prints the result. The terminal is the window it happens in, though in conversation the two words get used interchangeably. is a text-based way of giving instructions to a computer.

For example, you might click a folder icon to view its contents through a graphical interface. At the command line, you could type a command such as ls, which on macOS and Linux asks the operating system to list the files and folders in the current location.

Both actions can accomplish a similar task. One uses icons and a mouse, while the other uses typed text.

The command line is not a separate or mysterious computer hidden beneath the one you normally use. It provides another interface to the same operating system, files, applications, and hardware — a second door into the machine you already own.

What is the terminal?

The Concept · lights on your mapterminalThe application or window through which you reach the command line. The terminal is the window; the command line is what you do in it, though in conversation the two words get used interchangeably. is the application or window through which you access the command line.

On macOS, an application called Terminal is included with the operating system, Windows provides one called Windows Terminal, and engineers may also install other terminal applications with additional features.

The terminal displays the commands you type and the text returned by the computer.

A useful distinction is: the terminal is the window. The command line is the text-based way you interact with the computer through that window.

People often use the words terminal and command line interchangeably in ordinary conversation, so you do not need to correct someone who does.

What is a shell?

The Concept · lights on your mapshellThe software inside the terminal that reads your commands, interprets them, and helps the operating system carry them out. Different shells (Bash, Zsh, PowerShell) have slightly different commands and features, the way dialects differ. is the software inside the terminal that reads your commands, interprets them, and helps the operating system carry them out.

When you type a command, the terminal provides the visible window, while the shell determines what the command means.

Common shells include:

  • Bash
  • Zsh
  • PowerShell

Different shells may use somewhat different commands, syntax, and features, and you can think of them as different systems for communicating with the operating system through text.

On many Macs, the default shell is Zsh. Bash is common on Linux systems, while PowerShell is commonly used on Windows.

You do not need to memorize their differences. For now, recognize that the terminal is where you type and the shell is the program interpreting what you type.

Navigating files through the command line

The command line can be used to work with the same files and folders that you normally access through a graphical interface.

Commands can allow you to:

  • View the contents of a folder
  • Move from one folder to another
  • Create, rename, copy, or delete files
  • Open an application
  • Search for information
  • Run a program
  • Inspect what the computer is doing

For example, engineers often refer to the folder they are currently working inside as the current directory, and a command may behave differently depending on which directory they are currently in. Location can change behavior.

This is the same folder structure you explored in Lesson 4 of this module. The command line lets you navigate it by typing paths and commands rather than clicking folder icons.

Interactive — drive the terminal

Real commands, real output, replayed safely. Run each one and read what comes back.

you@your-laptop ~ $

Why do engineers use the command line?

The command line is useful because typed commands can be precise, efficient, and repeatable.

Suppose you need to find every file with a particular extension across hundreds of folders. Doing that manually might require many clicks, while a command can express the same request directly.

Commands can also be repeated. After discovering the correct command, an engineer can run it again without manually repeating every step.

Several commands can also be saved together in a file called a script, and running the script causes the commands to be performed in sequence. This is one of the foundations of automation: having computers repeat predictable work instead of requiring a person to complete every step manually. You will see the idea again when you learn how teams automatically test and deploy software.

Why remote computers often use the command line

Many remote machines that run software do not provide the kind of graphical desktop interface you use on a personal laptop.

A server may not have a physical monitor, keyboard, or collection of visible application windows, and engineers often manage it remotely through text-based tools because a graphical interface may be unnecessary. There may be nothing to click.

This makes the command line especially useful for working with Linux servers and cloud infrastructure.

The absence of a graphical interface does not make the machine a different kind of computer. It still has an operating system, processes, files, memory, storage, and applications. Engineers are interacting with it through commands.

What is SSH?

Concept · lights on your mapSSHShort for Secure Shell, a tool and protocol for securely connecting to a remote computer over a network. Once connected, your commands run on the remote machine, not your local one. It’s the everyday bridge between “local” and “remote.” stands for Secure Shell.

SSH is a tool and protocol used to securely connect to a remote computer over a network, and after connecting, an engineer can often use a shell on that remote machine as though they were typing commands directly into it. Your keyboard, their machine.

This connects to the distinction from the previous lesson:

  • Your laptop is the local machine.
  • The server is the remote machine.
  • SSH provides a secure connection between them.

Once connected, the commands generally affect the remote machine rather than the local one.

That distinction is extremely important. Deleting a file locally and deleting a file on a production server can have very different consequences, so engineers pay close attention to which machine and environment their terminal is currently connected to.

SSH can also be used for other secure tasks, but remote command-line access is the main concept to understand for now.

The command line is an interface, not a superpower

Movies often use scrolling green text to signal that someone is hacking or performing highly advanced technical work, but in reality a terminal is a text-based interface.

What makes it powerful is not its appearance but the control it gives the user and the ability to combine, save, and repeat commands.

A beginner looking at a terminal may see an intimidating wall of text. An experienced user sees commands, files, locations, and results.

You do not need to memorize commands to become technically literate. The goal is to understand what the terminal is and why engineers choose to use it.

The mental model to remember

A graphical user interface, or GUI, allows someone to control a computer through visual elements such as windows, icons, and buttons.

The command line allows someone to control a computer by typing commands.

The terminal is the application or window in which those commands are entered.

The shell reads and interprets the commands.

SSH allows someone to securely connect to and work with a remote machine.

The command line works with the same operating system, files, applications, and hardware as the graphical interface. It simply offers a different way to interact with them.

You should now be able to look at a terminal and understand that the person using it is giving typed instructions to either a local or remote computer.

Check — then the lesson continues

An engineer's screen shows a terminal, and she says: “Careful, I'm ssh'd into production right now.” What's the actual situation?

▼ answer the check to continue ▼