open atlas
↑ Back to track
Command line CLI · 01 · 01

What is a terminal?

A terminal emulator is the window; the shell is the program running inside it that reads your commands and executes them. The prompt is the shell's invitation to type.

CLI Foundations ◷ 15 min
Level
FoundationsJuniorMiddleSenior

You open an app and see a blinking cursor on a black background. You type ls and the screen fills with filenames. You type rm -rf and something important disappears forever. What is that window, and what is the program reading your keystrokes? Knowing the answer is the difference between using the terminal with confidence and dreading it.

By the end of this lesson you will be able to name the three layers — terminal, shell, prompt — and explain what each one does.

Goal

After this lesson you can distinguish a terminal emulator from a shell, explain what the prompt is, and say why the shell is the piece that actually matters for learning the command line.

1

A terminal emulator is just a window that displays text. In the 1960s–1980s, a “terminal” was a physical device — a keyboard and a screen — connected by a cable to a remote mainframe. Modern computers are powerful enough to run everything locally, so the physical terminal was replaced by a terminal emulator: an application (like GNOME Terminal, iTerm2, or Windows Terminal) that draws a text window and forwards your keystrokes to a program running inside it. The terminal emulator itself does not understand commands. It only displays characters and passes input along.

2

The shell is the program that actually reads and runs your commands. When the terminal emulator starts, it launches a shell — a text-based program that waits for your input, interprets what you type as a command, asks the operating system to run it, and prints the result back to the terminal. The most common shell on Linux is bash (Bourne Again SHell). Others include zsh (default on macOS since 2019), fish, and dash. The shell is what you are really learning when you learn the command line; the terminal emulator is just the container.

3

The prompt is the shell’s invitation to type. After the shell starts — and after every command finishes — it prints a line called the prompt and then waits. A typical bash prompt looks like:

user@hostname:~$

Each part has a meaning: user is your login name, hostname is the machine name, ~ is shorthand for your home directory (your current location), and $ signals that you are a regular user (root uses #). You type your command after the $ and press Enter; the shell reads it, runs it, and prints the prompt again.

Why this works

macOS ships with zsh and its default prompt looks different from the bash example above. The concepts — terminal emulator, shell, prompt — are identical; only the default text and colours differ. Everything in this unit uses bash/POSIX syntax, which runs unchanged in zsh for the basic commands covered here.

4

The shell is a full programming environment, not just a launcher. Shells support variables, conditionals, loops, and functions. A one-line shell command can chain several programs together, redirect output to a file, and process text — without writing a single line of Python or JavaScript. That power lives entirely in the shell layer, not in the terminal emulator. Changing your terminal emulator changes how text looks; changing your shell changes what commands you can write and how.

Worked example

Reading a prompt.

Imagine you open a terminal and see:

alice@devbox:~/projects$

Breaking it down:

  • alice — you are logged in as the user alice
  • devbox — the machine’s hostname is devbox
  • ~/projects — your current directory is projects inside your home folder
  • $ — you are a regular (non-root) user

You type ls and press Enter. The shell asks the OS to list the current directory, the OS returns the file names, the shell prints them, and then the prompt appears again — ready for the next command. The terminal emulator just drew the characters; the shell and OS did all the work.

Common mistake

A common first mistake is typing commands into the wrong place — for example, into a text editor or a browser address bar — and wondering why nothing happens. The shell only reads input when the cursor is sitting after the prompt in the terminal window. If you don’t see the prompt, the shell is either still running the previous command or the terminal is not focused.

Check yourself
Quiz

You type a command into a terminal window and press Enter. Which layer actually interprets the command and asks the OS to run it?

Recap

A terminal emulator is an application that draws a text window and connects you to a shell. The shell — bash, zsh, or another — is the program that reads your commands, asks the operating system to execute them, and prints the results. The prompt is the line the shell prints between commands to signal it is waiting for input. The terminal emulator is interchangeable; the shell is where the real power lives. Now when you open a terminal you know exactly what you are looking at and which layer is doing what.

Practice

Start at the top. Tasks go easiest → hardest: recall a fact, apply it to a case, then a senior-level stretch. Open one, attempt it, then reveal.

recallapplystretch0 of 4 done

Something unclear?

Ask a question about this lesson. Questions are anonymous and go straight to the author to make the lesson better.

shortcuts expand
search
K
prev piece
k
next piece
j
cycle tier
t
this menu
?
sources3
expand
  1. 01
  2. 02
  3. 03

Trademarks belong to their respective owners. Editorial reference only.