OnCallReady

Lesson 1.1 · First Login · 12 min read

Where you are

In plain words

Think of a walkie-talkie. The plastic handset in your hand is the terminal: it only carries sound. The person at the other end who listens and acts on what you say is the shell. The radio waves between you are SSH. If you shout "turn on the light", the handset does not know what a light is; the person on the other end does.

On your Mac, Terminal.app is the handset, SSH carries your keystrokes to 10.64.0.2, and bash on oncall-lab reads them and runs commands. The prompt learner@oncall-lab:~$ is that person telling you who they think you are, which building you are in, which room, and whether you have the master key (#) or not ($).

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).

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

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:

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.

When you created the VM, UTM offered two modes:

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

Why it helps

Knowing which layer you are talking to saves real time. When copy-paste mangles a command, that is the terminal. When a variable expands wrongly, that is the shell. When nothing responds at all, that is often SSH or the network. Reading the prompt before pressing Enter is how you avoid running a destructive command on the wrong machine: engineers keep several SSH sessions open at once, and the hostname in the prompt is the only thing telling them apart.

uname -m matters too: a program built for x86_64 does not run on arm64 and vice versa, so knowing the architecture of the machine in front of you is the first check when a downloaded tool refuses to start.

Commands in this lesson

pwd whoami hostname uname

FAQ

What is the actual difference between a terminal, a shell and a console?

The terminal (emulator) is a program that draws text and sends keystrokes: Terminal.app, iTerm, the pane here. The shell is the program interpreting what you type: bash, zsh, sh. "Console" means the screen and keyboard attached directly to the machine; in UTM it is the VM's own window, which works even when SSH or the network is broken. That is why a broken SSH setup is fixable from the UTM window.

My Mac uses zsh. Does it matter that the VM uses bash?

For daily commands, barely: cd, pipes and redirection behave the same. It matters for scripts and for some details, like which settings file is read at startup (~/.zshrc vs ~/.bashrc) and how unquoted variables behave. Servers and scripts overwhelmingly use bash, so learn bash's rules and treat zsh as your personal shell on the Mac.

Is SSH like Remote Desktop or VNC?

No. SSH carries text, not a picture of a screen. The remote side runs a shell and sends back its output. That is why it works fine over a slow link, why you can send the output of a remote command straight into a local one, and why Ubuntu Server has no desktop to show you. SSH can also copy files (scp), but it never shows you a screen.

What does aarch64 mean and why does it matter?

aarch64 is Linux's name for 64-bit ARM, the CPU architecture of Apple Silicon; Ubuntu calls the same thing arm64. Programs are compiled for one architecture, so an x86_64 program cannot run directly on your VM and vice versa. For the commands in this course it makes no difference: ls, apt and the rest behave identically on both.

Why is there a $ in some examples and a # in others?

The last character of the prompt shows your privilege: $ for a normal user, # for root. Documentation copies that convention, so # apt install x means "run this as root", not "this is a comment". When you see # in your own prompt (after sudo -i), every command runs without permission checks, which is exactly when to slow down.

In an interview Junior

What is the difference between a terminal, a shell and SSH?

The prompt learner@oncall-lab:~$ tells you which user, which machine, which directory, and $ (normal user) or # (root) - read it before pressing Enter.

Also asked: What is the difference between virtualization and emulation? · What does uname -m print on an Apple Silicon VM, and why does the architecture matter? · Why practise on a Linux VM instead of the Mac's own terminal?

Practise this lesson in the terminal Free, in your browser - a real Ubuntu terminal to try it in, with missions that check your work.