Lesson 1 of 7 · 0 of 1 exercises solved

Terminal vs Shell — Two Different Programs

What people call 'the ' is really two programs: the terminal draws the window, and the runs your commands. Knowing which does what makes the rest of this track easier to follow.

The terminal emulator (Windows Terminal, iTerm2, GNOME Terminal) is a graphics program: it draws text, handles fonts and colors, turns your keystrokes into . The shell (bash, zsh, PowerShell) is a text program running inside it: it reads a line like 'ls -l', finds and runs the program, and hands the output bytes back to the terminal to draw. Either can be swapped out independently — same terminal can run bash or zsh; same shell runs in any terminal.

Text
you press 'l', 's', Enter
   |
   v
terminal emulator     "I turn keys into bytes and bytes
   |                   into pixels. I don't know what ls is."
   v
shell (bash/zsh)      "ls? Let me find that program,
   |                   run it, and give you its output."
   v
the ls program        does the actual work, prints results
   |
   v  (bytes flow back up the same path)
pixels on your screen

Why 'emulator'? Real terminals were hardware — a VT100 was a screen and keyboard wired to a distant computer, speaking a byte protocol over a serial cable. The hardware died; the byte protocol survived. Modern terminal windows emulate those devices so faithfully that 1978 software still runs — and that same protocol is why SSH-ing to a server feels identical to a local window.

Common question

Is the terminal the same thing as the shell?

Three programs are involved when you run a command. The terminal emulator draws the screen and handles the keyboard. The shell reads your line, expands it, finds the program and runs it. The program does the actual work, reading standard input and writing standard output and standard , which flow back through the terminal to your screen.

Knowing this split clears up a lot of confusion: why colours are escape sequences the terminal interprets, why cd has to be built into the shell instead of being a separate program, why a is the shell's work and not the program's, and why the same commands behave the same over ssh.

Source: Over ssh, the shell runs on a remote machine while your local terminal just displays it. The two are separate programs that happen to be connected.

Common mix-ups

Each of these sounds reasonable. Think about why it is wrong, then open the explanation.

  • The black window with the prompt is the shell, so the two words name one program.

  • Since the shell prints the output, it must be doing the work of every command.

  • The terminal understands commands like ls and cd.

Practice

Shell exercise

First steps

Get your bearings. Print the working directory, list what is in it, read notes.txt, then move into the lessons directory and list it too.

4 checks
Welcome to the practice shell. It is a simulation: nothing you do here can hurt a real machine.
Type help at any time.
learner@sandbox:~$
simulated bashTab completes ↑ history
Finished reading?1 exercise still open. You can come back to it later.

Tip: use the ← and → keys to move between lessons.