Course outline · 0% complete

0/29 lessons0%

Course overview →

What is a terminal?

lesson 1-1 · ~8 min · 1/29

Your computer can be driven with text

Every computer runs an operating system (OS): the master program (Linux, macOS, Windows) that manages files, memory, and every app you open. You usually control it by clicking. There is a second way: typing commands.

There are three concrete reasons to learn the typed way. Most servers, the machines that run websites, databases, and AI models, have no screen or desktop at all, so a text connection is the only way in. Typed commands can be saved and replayed, which turns a 40-click chore into one line you rerun tomorrow. And nearly every developer tool (git, compilers, package managers) is built terminal-first, with graphical wrappers added later, so the terminal is where the full feature set lives.

Three words you need, defined once:

WordWhat it is
TerminalThe window that displays text. It does nothing but show characters and accept keystrokes.
ShellThe program running inside the terminal that reads what you type and acts on it. The most common shell is bash, and it is what this course teaches.
CommandOne instruction, like echo hello. The shell runs it, prints any output, and waits for the next one.

So the loop is: a command is typed → the shell asks the OS to do it → the result is printed back.

sam@laptop:~$ echo helloyour usernamethe machinewhere you are (~ = home)$ = ready for a commandwhat YOU type
The prompt is the text the shell prints while waiting for you. Everything before $ is information, and you type after it.

Your first command: echo

echo is the simplest command there is: it prints back whatever you give it. That makes it the ideal command to learn first, because it only ever writes text to the screen and cannot damage anything.

echo Hello, terminal!

One detail matters here. The shell treats spaces as separators, so it collapses the run of blanks between words before echo ever sees them. To keep text exactly as written, extra spaces and all, wrap it in double quotes: echo "like this". Both forms appear in the example below, so the difference in output is easy to compare.

Plain text versus quoted text

The first echo prints a plain message. The second wraps its argument in double quotes, so the extra spaces survive into the output.

echo Hello, terminal!
echo "Quotes   keep   spacing"

Output

Hello, terminal!
Quotes   keep   spacing

Whatever sits inside the quotes is what gets printed, character for character. That is the whole rule: unquoted text is split on whitespace and rejoined with single spaces, quoted text is passed through untouched.

It is the shell (bash) that actually reads a command and decides what to do with it, not the terminal. The terminal is only the display: a window that draws text and forwards keystrokes. The shell is the program running inside that window, and it reads each line, interprets it, and asks the operating system to carry it out.

Keeping those two straight explains a lot of later behavior. When quoting rules, wildcards, or variables come up, they are shell features, so they work the same no matter which terminal window the shell happens to be drawn in.

Printing several lines is just a matter of running echo once per line. Each echo writes its text and then a newline, so the next command's output starts fresh on the row below.

echo "Hello, world"
echo "I am learning bash"

Output

Hello, world
I am learning bash

Two things are worth noticing in that output. Each echo ends its own line automatically, which is why no blank line or manual line break is needed between them. And the text is reproduced exactly as quoted, including the capital H and the comma after Hello, because quoted text is never reinterpreted.