Shell vs Terminal: What's Actually the Difference?
Table of Contents
The terms "shell," "terminal," "command line," and "CLI" are used interchangeably all the time, and honestly, that's usually fine. But they are not the same thing, and understanding the difference makes everything else about working in a text-based environment easier. Here we'll cover what a terminal actually is, what a shell does, why developers prefer typing commands over clicking buttons, and some shell basics like variables and history.
All the content from our Boot.dev courses are available for free here on the blog. This one is the "Command Line" chapter of Learn Linux. If you want to try the far more immersive version of the course, do check it out!
What Is a Terminal?
Historically, the word "terminal" meant a physical device that you could type commands into, essentially a keyboard and a screen.

These days, when we say "terminal," we really mean "terminal emulator." A terminal emulator is a program that emulates a physical terminal. It's a program that lets you type commands into a window on your computer.
Which commands you're able to use isn't determined by the terminal emulator, but by the shell. Your terminal emulator is just responsible for drawing text on the screen and processing your keystrokes.
What Is a Shell?
So if your terminal is just a program that lets you issue text-based commands and renders the output of those commands...
...What is the program that runs those commands???
That's a shell.
Shells do a lot of things, but their main job is to interpret the commands you type and execute them. The echo command is the "hello world" of the command line: it just prints text back out to you. Type a command, press Enter, and the shell runs it:
echo "I use Linux btw"
# I use Linux btw
Commands don't need to be complicated to be useful, either. The whoami command is about as simple as commands get: it prints the username of the user you're currently logged in as.
Shells are REPLs
Shells are often referred to as "REPLs". REPL stands for:
- Read
- Eval (evaluate)
- Loop
This is a fancy way of saying that shells are programs that:
- Read the commands you type
- Evaluate those commands, usually by running other programs on your computer
- Print the output of those commands
- Give you a new prompt to type another command and repeat
The expr command evaluates a simple expression and prints the result. It's a tiny program, but it's a great way to watch the shell "read, eval, and print":
expr 123456 + 7890
# 131346
Prompts vs outputs
If you're confused about prompts vs outputs, here's a quick explanation. Here's a session with my shell:
wagslane:~$ echo hello
hello
wagslane:~$
This is the "prompt": wagslane:~$
It's just telling me that the shell is ready to accept a command.
This is the command I typed: echo hello
Once I pressed Enter, the shell read my command, evaluated it, and printed the output: hello
Then, the shell printed a new prompt so I can run a different command: wagslane:~$
Shell vs Terminal vs Console vs Command Line
You'll often hear the terms "terminal," "shell," "command line," "CLI," and "command prompt" used interchangeably (despite some technical differences) to refer to the same thing: a program that allows you to interact with your computer in a text-based way. Here's how they break down when you do want to be precise:
| Term | What it actually means |
|---|---|
| Terminal (emulator) | The window that draws text on the screen and processes your keystrokes |
| Shell | The program that interprets and executes your commands (e.g. Bash, Zsh) |
| Command line / CLI | The general text-based way of interacting with a computer |
| Console | Historically the physical hardware; today mostly a synonym for "terminal" |
Nobody will look at you funny for saying "open a terminal and run this command." But the distinction matters when you're making changes to your setup: installing a new terminal emulator changes how your window looks and feels, while switching your shell changes which commands and syntax you can use.
CLI vs GUI: Why Use the Command Line?
If you don't have a technical background, you're probably used to interacting with your phone or computer using a graphical user interface (GUI). When you use a mouse to click on fancy icons, buttons, and menus, you're using a GUI.
Click to play video
As a real™ developer, you'll mostly run your code using a command line interface (CLI) instead. For example, in Python, you run a code file like this:
python main.py
To be fair, it's usually easier to teach people to use a GUI than a CLI. You can simply point to things and say "click here" or "drag this there." But GUIs do have some drawbacks:
- They're weak. You are given much more control over your computer through a CLI. With a GUI you're limited to the options that the developer of the GUI has given you.
- They're slow. Once you know the commands to type, it's much faster to type them than to click through endless menus with a mouse.
- They're not as reproducible. If you want to share a set of instructions, you can just copy and paste commands without worrying about screen sizes and user preferences.
- They're not automatable. It's easy to write code that manipulates text, but it's much harder to write code that manipulates GUIs.
- They're not as cool. You will be invited to 90% fewer romantic outings if you are a GUI user.
How Do Shell Variables Work?
Which shell are you probably running?
- If you're using Ubuntu on WSL, you're probably running a Bash shell.
- If you're using macOS, you're probably running a Zsh shell.
- If you're running full Linux, I pray you already know what you're using.
The point is that you're probably using Bash or Zsh, and for most purposes, they're basically the same (they're even configured in similar ways).
Both Bash and Zsh are shells, and they also happen to be powerful programming languages. They have variables, functions, loops, and more. That said, only crazy people write large programs in shell languages... shells are optimized for running other programs and writing small scripts, not for writing large applications.
To create a variable:
name="Lane"
Notice there are no spaces between the variable name, assignment operator = and value "Lane".
To use a variable, you prefix its name with a $:
echo $name
# Lane
Unlike in Python, where you can just use a variable's name, in your shell you need to prefix the variable name with a $ to use it, else it would just print name instead of the value.
Interpolating a variable in a string works the same way:
echo Hello $name
# Hello Lane
Variables you create like this only live in your current shell session. There's a related concept, environment variables, that get passed down to the programs your shell runs — the most famous one being PATH.
How Do You See Your Shell History?
When you're working in a REPL, it's really helpful to be able to see the commands you've typed in the past. That way you can easily re-run them, or copy and paste them into a script. To print out the history of commands you've typed in your shell, you can use the history command:
history
# 1 echo "I use Linux btw"
# 2 expr 123456 + 7890
# 3 name="Lane"
# 4 echo Hello $name
You'll often want to re-run a command. You could just type it out again, but assuming you don't have the WPM of ThePrimeagen, that's a pain.
Instead, you can use the ↑ and ↓ arrows to quickly cycle through your command history. Pressing the ↑ key walks backward through the commands you've run, one at a time. Once you've gone too far back, the ↓ key walks you forward again toward your most recent command. It's a huge time-saver: instead of retyping a long command, you just arrow up to it and press Enter.
If your terminal is feeling cluttered with text, you can clear it with the clear command, or by pressing Ctrl+L. This won't delete your history, it will just clear the screen.
So, the terminal draws the text, the shell runs the commands. From here, the natural next step is actually moving around your machine, so read up on filesystem commands like ls, cd, and pwd, or work through the whole Learn Linux course interactively.
Frequently Asked Questions
Are the shell and the terminal the same thing?
No. The terminal (really a terminal emulator) is the program that draws text on the screen and processes your keystrokes, while the shell is the program running inside it that interprets and executes your commands.
Is Bash a shell or a terminal?
Bash is a shell. It reads the commands you type, runs them, and prints the output. Programs like GNOME Terminal, iTerm2, or Windows Terminal are terminal emulators that Bash runs inside of.
What is a REPL?
REPL stands for read, eval, print, loop. It describes any program that reads a command you type, evaluates it, prints the result, and then gives you a new prompt so you can repeat the cycle. Shells are REPLs.
What's the difference between a CLI and a GUI?
A CLI (command line interface) lets you control your computer by typing text commands, while a GUI (graphical user interface) uses windows, icons, and mouse clicks. CLIs are faster, more powerful, more reproducible, and easier to automate once you know the commands.
Does the clear command delete my shell history?
No. The clear command (or Ctrl+L) only wipes the visible text off the screen. Your command history is untouched, and you can still see it with the history command or by pressing the up arrow.
