It is your first day on a platform team. Someone says "SSH into the box and check it". There is no screen, no mouse, no app to click - only a blinking cursor. This lesson is about knowing what that cursor is connected to, and what the few characters in front of it are telling you.
What you need to know already: nothing from Linux. Chapter 0 used a terminal to read logs; here you find out what a terminal really is.
The machine you are on
You are not typing on your Mac. You are typing on a VM (virtual machine: a whole pretend computer - its own CPU, memory and disk - that runs as a program on your real computer). The real computer is called the host; the VM is the guest.
The program that runs the VM is a hypervisor. Yours is UTM, a Mac app (underneath it uses a hypervisor called QEMU).
On that VM you installed an OS (operating system: the base software that runs everything else on a computer). The OS is Linux, and specifically Ubuntu Server - a distribution (a packaged version of Linux: the Linux core plus a chosen set of tools, made by one team; Ubuntu is one, Debian and Red Hat are others).
The core of Linux is the kernel: the one program that talks to the hardware and decides which program gets the CPU, memory and disk. Everything else asks the kernel for things.
Three words people mix up
Terminal is the window. On your Mac that is Terminal.app or iTerm (here, the dark pane on the left). It draws characters and sends your keystrokes somewhere. It does not understand a single Linux command.
Shell is the program reading those keystrokes and deciding what they mean. On this box it is bash. It is the thing that knows what | means and what happens when a command fails.
SSH (Secure SHell) is the encrypted connection between them when the shell is on another machine. You type in Terminal.app on the Mac, the keystrokes travel to the VM at the address 10.64.0.2, a bash on the VM reads them, and its output travels back. That is all "remote work" is.
During the Ubuntu install you ticked OpenSSH server: the program on the VM that accepts those SSH connections. It is not a remote desktop - it never shows you a screen. It is a remote command line.
The prompt is telling you four things
The prompt is the text the shell prints when it is ready for your next command:
learner@oncall-lab:~$
| | ||
| | |+- $ = normal user. A # here means you are root.
| | +-- where you are. ~ means your home directory.
| +------------- which machine (its hostname).
+-------------------- who you are (your username).
- hostname: the machine's name. Yours is
oncall-lab. - home directory: your personal folder,
/home/learner. The shell shortens it to~. - root: the all-powerful administrator account. It can read and change anything. You are not root; you are
learner. Lesson 1.11 shows how to borrow root's power for one command.
Watch that $. The most common "why did that not work" on day one is running something that needs root as a normal user.
Ask the box
A command is a word you type that names a program, optionally followed by more words. Press ▶ next to a command to type it into the terminal, or type it yourself and press Enter:
$ whoami
learner
$ hostname
oncall-lab
whoami- prints which user you are.hostname- prints the machine's name.
Why a Linux VM and not just the Mac's Terminal
macOS is related to Linux (both descend from Unix, an older OS), so ls and cd work there too. But macOS is not Linux:
- the program that starts and looks after every other program is different (launchd on the Mac, systemd on Linux - lesson 1.15 and chapter 2);
- Linux has special folders, like
/proc, where the kernel shows you what is running - macOS does not; - the kernel and many tools behave differently.
Servers at work run Linux. Learn on Linux.
CPU architecture: arm64, and what UTM asked you
A CPU only understands one family of instructions - its architecture. A program built for one architecture does not run on another.
- arm64 (Linux also calls it aarch64): Apple Silicon Macs, phones.
- x86_64 (also called amd64): Intel and AMD chips, most servers.
When you created the VM, UTM offered two modes:
- Virtualize - the guest uses the same architecture as the host (arm64 on arm64), so its instructions run directly on your Mac's CPU. Near-native speed. This is what you picked, and why you downloaded the arm64 ISO (the installer image: a single file holding the whole install disc).
- Emulate - UTM pretends to be a different CPU (say x86_64) and translates every instruction. It works, but it is several times slower.
Check the architecture any time:
$ uname -m
aarch64
uname prints facts about the running kernel; -m (m for machine) asks for just the hardware architecture. A flag (or option) is a word starting with - that changes what a command does.
Most servers you will meet at work are x86_64. The commands you learn here are identical on both.
Nothing on this box has a GUI
You chose Ubuntu Server: no GUI (graphical user interface - windows, icons, a mouse pointer), no desktop, no browser. Every answer has to come from a command. That is the point of this whole block.
What you can now do
- Say what the terminal, the shell and SSH each do.
- Read a prompt: user, machine, where you are, root or not.
- Explain why the VM is arm64 and what Virtualize meant.