Module 1 · First steps in the terminal
What is a shell, and why the terminal
The three layers behind a blinking cursor: terminal, shell and kernel, and why typing commands is still the fastest way to drive a computer.
What you will learn
- Tell apart the terminal, the shell and the kernel.
- Explain the read–run–print loop every shell performs.
- Type a first command and read its answer.
The black window with a blinking cursor is three programs wearing one coat. The terminal is the window itself: it draws characters and sends your keystrokes on. The shell is the program behind it that reads what you typed, decides what it means and runs it. The kernel is Linux proper, the layer that owns the disk, the memory and the screen and does the real work on the shell's behalf. In this course you will spend almost all of your time talking to the shell.
What a shell actually does
A shell runs one loop forever: print a prompt to say it is ready, read one line, split it into a command and its arguments, run it, show whatever comes out, and print the prompt again. That is all. Every fancy thing you will learn — pipes, wildcards, scripts — is a refinement of that loop. The name is a pun: it is the outer layer around the kernel, the part of the operating system you can touch.
~% echo hello
hello
~% whoami
root
~% uname
Linux
~%
Read that transcript line by line. ~% is the prompt. echo hello is a command (echo) with one argument (hello); echo simply prints its arguments back. whoami answers with the user you are logged in as, and uname with the kernel's name. After each answer the prompt returns: the loop has come round again.
Why bother, when there are windows and mice
- Precision. "Rename every
.logolder than a week" is one line in a shell and an afternoon of clicking in a file manager. - Repeatability. A command you typed once can be saved, shared and run again on another machine, identically.
- Reach. Servers, routers, containers and cloud machines have no screen at all. The shell is the only door they have.
- Composition. Small tools that do one thing can be chained into tools nobody wrote. You will do this from module 3 on.
Which shell, which Linux
There are several shells. bash is the default on most desktop distributions; zsh on macOS; ash, a smaller, stricter POSIX shell, on routers, Alpine Linux and embedded systems. The practice machine next to this lesson runs BusyBox, a single program that bundles ash and about 260 small commands into one 580 KB file. Everything you learn here works unchanged in bash; a few bash extras do not exist here, and the course will say so when it matters.
| Layer | Job | Here |
|---|---|---|
| Terminal | Draws text, forwards keys | The VM screen in your browser |
| Shell | Reads commands, runs them | BusyBox ash, started as /bin/sh |
| Kernel | Owns hardware, files, processes | Linux 4.16 |
Your first command
Click into the machine, type echo hello and press Enter. If the word comes back, you have completed a full turn of the loop. Try echo with several words, then with none. Make a typo — ecoh hello — and read the complaint: sh: ecoh: not found. The shell never guesses. That strictness feels cold at first and becomes the thing you trust most.
Commands in this lesson
| Command | What it does |
|---|---|
echo WORDS | Print its arguments back, one line. |
whoami | Show the user you are logged in as. |
uname | Show the kernel's name (`Linux`). |
touch FILE | Create an empty file (a preview; lesson 12 goes deeper). |
Quiz
Which component reads the line you typed and decides what to run?
- The terminal
- The shell
- The kernel
What does `echo one two` print?
- `one two`
- `echo one two`
- Nothing; `echo` needs quotes
- `one` and `two` on separate lines
The shell on the practice machine is…
- bash
- zsh
- BusyBox ash
- PowerShell
You type `ecoh hi`. What happens?
- The shell guesses you meant `echo` and prints `hi`
- The shell reports `ecoh: not found`
- The machine reboots
Why do servers and cloud machines rely on a shell?
- Because they usually have no screen or mouse at all
- Because graphical programs are illegal on servers
- Because the kernel cannot draw windows
Practice
Make the shell print the word `hello`.
Type this command exactly as written and press Enter: `touch /root/lab/l1/my-first-file`. It creates an empty file: your first change to the machine.
Ask the shell which user you are logged in as.
Open this lesson in the app to do the tasks in a real Linux machine and have them checked.