Home / Learn Linux / Lesson 1
What Linux is and how to get it
Kernels and distros, which one to pick, and an Ubuntu 26.04 machine of your own in a few minutes.
- Lesson
- 1 of 30
- Time
- About 45 minutes
On this page
- What Linux is
- Distributions
- The one this course uses
- Ways to run Linux
- Set up Ubuntu with Multipass
- Save and restore with snapshots
- Or use WSL on Windows
- Look around your new machine
- Keep it up to date
- Common mistakes
- Practice
- Cheat sheet
What Linux is
Linux is the kernel of an operating system. The kernel is the program that starts first and runs the machine: it decides which program gets the CPU next, hands out memory, reads and writes the disk, and sends and receives network traffic. Every other program asks the kernel when it needs any of that.
Linus Torvalds wrote the first version in 1991 as a student in Helsinki. Today thousands of people and companies work on it, and it's free for anyone to use and change.
A kernel on its own isn't much use. You also need a shell to type commands into, the commands themselves (ls, cp, mkdir and hundreds more), a way to install software, and a lot of settings that make it all work together. When people say "Linux" they usually mean that whole bundle.
You use Linux every day even if you've never seen it. It runs most web servers and cloud machines, every Android phone, most Wi-Fi routers and smart TVs, and all of the world's 500 fastest supercomputers. If you want to work with servers, cloud, DevOps or security, you'll be typing into a Linux shell most days.
Try it
- In one sentence, what's the difference between the kernel and the rest of the system?
- Name two things around you that probably run Linux.
Answer
- The kernel controls the hardware (CPU, memory, disk, network), and everything else is programs you use, like the shell and commands, which ask the kernel to do those things for them.
- An Android phone, a Wi-Fi router, a smart TV, a set-top box. They run the Linux kernel even though you never see a terminal.
Distributions
A distribution, or distro, is the bundle: the Linux kernel plus the commands, a package manager for installing software, default settings, and often a desktop. All distros use the same kernel, give or take a version, so what you learn on one mostly works on the others. The biggest differences are the package manager and how quickly new versions of software arrive.
| Distro | Installs software with | Good for |
|---|---|---|
| Ubuntu | apt | Servers, cloud, desktops, learning |
| Debian | apt | Very stable servers. Ubuntu is built on it |
| Linux Mint | apt | A desktop that feels familiar after Windows |
| Fedora | dnf | The newest software, sponsored by Red Hat |
| RHEL, Rocky, AlmaLinux | dnf | Company servers |
| Arch | pacman | Building your system piece by piece |
| Alpine | apk | Tiny containers |
Most servers you'll meet at work run Ubuntu, Debian or one of the Red Hat family (RHEL, Rocky, AlmaLinux).
Try it
- Which two distros in the table install software the same way Ubuntu does?
- You join a company whose servers run Rocky Linux. Which command will you use to install software there?
Answer
- Debian and Linux Mint, with
apt. Mint is built on Ubuntu, and Ubuntu is built on Debian. dnf, the same as Fedora and RHEL.
The one this course uses
This course uses Ubuntu 26.04 LTS, the server edition. There's no desktop: everything happens in the terminal, which is how you'll work on real servers anyway.
Ubuntu's version number is the year and month it came out, so 26.04 means April 2026. A new version comes out every six months. The April release in every even year is an LTS (long-term support) release and gets five years of free security updates. Ubuntu Pro, free for personal use on up to five machines, stretches that to ten. The October and odd-year releases get only nine months, which is why servers almost always run an LTS.
Every version also has a codename. 26.04 is Resolute Raccoon, and you'll see resolute in config files and download links.
Ubuntu 26.04 also swapped some of the oldest commands for new versions written in Rust. ls, cat and many others now come from a project called uutils, and sudo is now sudo-rs. They're built to behave the same, so you won't notice in daily use, but their --version output and a few error messages look different from older guides and videos. cp, mv and rm are still the classic GNU versions.
The reels for this course are filmed on Pop!_OS 24.04, a desktop distro built on Ubuntu 24.04. Every command in the course works there too. A version number or a message might look slightly different from this page, and that's fine.
Everything in this course also works on Debian, and most of it works on any distro. When Ubuntu does something its own way, the lesson says so.
Try it
- When did Ubuntu 24.04 come out, and is it an LTS?
- Is Ubuntu 25.10 an LTS? Would you put it on a server you need to keep for three years?
Answer
- April 2024, and yes: April releases in even years are LTS.
- No. It came out in October, so it gets nine months of updates, and you'd have to upgrade twice a year to stay safe. Use an LTS.
Ways to run Linux
You don't need to wipe your laptop to learn Linux. Any of these works:
| Option | What it is | Worth knowing |
|---|---|---|
| Multipass | A free tool from Canonical, the company behind Ubuntu, that makes Ubuntu virtual machines with one command | Works on Mac, Windows and Linux, and it's easy to reset. This course uses it |
| WSL | Linux built into Windows | Fast and handy, but networking, disks and startup work differently from a real server |
| A cloud server | A machine you rent by the month | The real thing. Lesson 30 sets one up |
| Your own hardware | An old laptop, or Linux next to Windows (dual boot) | Fastest, but one wrong click while installing can erase your other system |
A virtual machine (VM) is a whole computer simulated inside yours, with its own memory, disk and network. Anything you break inside it stays inside it, and you can throw it away and make a new one in a minute. That's what you want while learning.
Already running Ubuntu or Pop!_OS on your computer? You can follow most lessons right there. Still make a VM for the lessons on users, permissions, disks and the firewall, because those change your system and you'll break things on purpose.
Try it
- You're on Windows and want everything in this course to behave exactly as it would on a server. Multipass or WSL?
- What happens to your own computer's files if you delete everything inside the VM?
Answer
- Multipass. WSL is fine for most lessons, but the networking, disk and service lessons behave differently there.
- Nothing. The VM's disk is one big file on your computer, and the VM can't see your files.
Set up Ubuntu with Multipass
Install Multipass from canonical.com/multipass/install:
- Mac: download the installer. It works on any Intel or M-series Mac with macOS 14 or newer. If you use Homebrew,
brew install --cask multipassdoes the same. - Windows: download the installer. It works on Windows 10 and 11, Home, Pro or Enterprise, and needs the Virtual Machine Platform feature turned on. Set your network to Private in Windows settings, or Windows may stop Multipass from starting.
- Linux: run
sudo snap install multipass.
Now open a terminal on your computer (Terminal on a Mac, PowerShell on Windows) and make a machine called linux with 2 CPUs, 4 GB of memory and a 20 GB disk:
$ multipass launch 26.04 --name linux --cpus 2 --memory 4G --disk 20GThe first launch takes a few minutes while it downloads Ubuntu. Don't skip the flags: without them you get 1 CPU, 1 GB of memory and 5 GB of disk, which later lessons will outgrow. If your computer has 8 GB of memory or less, use --memory 2G instead.
Then step inside it:
$ multipass shell linuxThe prompt changes to ubuntu@linux:~$. Learn to read it, because it tells you where your commands will run. ubuntu is the user you are, linux is the machine you're on, and ~ is the folder you're in (your home folder). Everything you type now runs inside Ubuntu. Type exit to go back to your own computer.
These commands run on your own computer, not inside the VM:
| Command | What it does |
|---|---|
multipass list | Shows your machines, whether they're running, and their IP addresses |
multipass info linux | Shows one machine's details: CPUs, memory and disk use, Ubuntu version |
multipass stop linux | Shuts the machine down |
multipass start linux | Starts it again |
multipass exec linux -- whoami | Runs one command inside it without opening a shell |
multipass delete linux | Deletes the machine for good, after asking you to confirm |
Try it
- Exit the VM, run
multipass list, and find your machine's IP address. - Stop the machine and run
multipass listagain. Then runmultipass shell linux. Does it still work? - Without opening a shell, ask the VM which user it runs commands as.
Answer
$ exit $ multipass list $ multipass stop linux $ multipass list $ multipass shell linux
After the stop, multipass list shows the machine as Stopped. multipass shell still works, because it starts a stopped machine for you.
$ multipass exec linux -- whoami
ubuntuSave and restore with snapshots
A snapshot saves the whole machine exactly as it is. If you break something later, you restore the snapshot and you're back where you were. Take one before any lesson where things might break. The machine has to be stopped first:
$ multipass stop linux $ multipass snapshot linux --name fresh $ multipass start linux
To go back to it later:
$ multipass stop linux $ multipass restore linux.fresh
Before restoring, Multipass asks whether to snapshot the current state too. Answer n if you just want the broken state gone.
Try it
- Take a snapshot called
fresh. - Start the machine, create a file with
touch oops, and check it's there withls. - Restore
fresh, then check whetheroopsstill exists.
Answer
$ multipass stop linux $ multipass snapshot linux --name fresh $ multipass shell linux ubuntu@linux:~$ touch oops ubuntu@linux:~$ ls oops ubuntu@linux:~$ exit $ multipass stop linux $ multipass restore linux.fresh $ multipass shell linux ubuntu@linux:~$ ls
The last ls prints nothing. You made the file after the snapshot, so restoring removed it.
Or use WSL on Windows
If you'd rather use WSL, open PowerShell as administrator (right-click it, then Run as administrator) and run:
$ wsl --installRestart when it asks. After the restart Ubuntu opens and asks you to choose a username and password. Remember the password: sudo will ask for it later.
wsl --install gives you Ubuntu's current LTS. Check the version you got with cat /etc/os-release (you'll meet it in a minute). If it's older than 26.04, list the versions on offer and install the right one by its name from the list:
$ wsl --list --online $ wsl --install -d <name>
On WSL your prompt shows your own username and your PC's name instead of ubuntu@linux. That's fine. When a lesson works differently on WSL, it says so.
Try it
- In PowerShell, run
wsl -l -v. Which WSL version is your Ubuntu using?
Answer
The VERSION column should say 2. New installs use WSL 2. If yours says 1, switch it with wsl --set-version Ubuntu 2, using the name shown in the NAME column.
Look around your new machine
Open a shell in the VM (multipass shell linux) and try these. Your numbers will be a little different from the ones here, and that's expected.
whoami and hostname: who and where you are
$ whoami ubuntu $ hostname linux
whoami prints the user you're logged in as, and hostname prints the machine's name. They're the first two parts of the prompt. When you work with several servers at once, these two keep you from running a command on the wrong one.
Try it
- Run
whoamion your own computer (exit the VM first) and then inside the VM. Are they the same?
Answer
Usually not. On your computer it prints your own username. In the VM it prints ubuntu, the user Multipass made for you. Two different machines, two different users.
uname: the kernel
$ uname -r 7.0.0-28-generic $ uname -m aarch64 $ uname -a Linux linux 7.0.0-28-generic #28-Ubuntu SMP PREEMPT_DYNAMIC Sun Jun 21 00:50:10 UTC 2026 aarch64 GNU/Linux
uname -r prints the kernel's release, its version. uname -m prints the type of processor the system runs on: aarch64 (also called arm64) on M-series Macs and many cloud servers, x86_64 on most Intel and AMD PCs. uname -a prints everything at once: kernel name, hostname, release, build date and processor type.
Try it
- Print just the kernel name. It's the default, so try
unamewith no flags. - Is your VM an ARM or an x86 machine?
Answer
$ uname
LinuxFor the second, run uname -m. aarch64 means ARM, x86_64 means x86. Software you download for one won't run on the other, so this matters the day you install something by hand.
/etc/os-release: which distro and version
$ cat /etc/os-release
PRETTY_NAME="Ubuntu 26.04 LTS"
NAME="Ubuntu"
VERSION_ID="26.04"
VERSION="26.04 LTS (Resolute Raccoon)"
VERSION_CODENAME=resolute
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=resolute
LOGO=ubuntu-logocat prints a file, and /etc/os-release is the file that describes the system. The lines you'll use most are PRETTY_NAME (the full name), VERSION_ID (the version number) and VERSION_CODENAME (the codename). ID_LIKE=debian says Ubuntu is built on Debian, which is why Debian instructions usually work here too.
lsb_release -a shows the same thing in a shorter form:
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 26.04 LTS
Release: 26.04
Codename: resoluteTry it
- Which codename does your VM print?
catprints any text file. Print/etc/hostname. What's in it?
Answer
resolute, fromVERSION_CODENAME.- The machine's name:
$ cat /etc/hostname
linuxfree, nproc and df: memory, CPUs and disk
$ free -h total used free shared buff/cache available Mem: 3.8Gi 405Mi 2.8Gi 1.0Mi 770Mi 3.4Gi Swap: 0B 0B 0B $ nproc 2 $ df -h / Filesystem Size Used Avail Use% Mounted on /dev/vda1 19G 2.5G 16G 14% /
free -h shows memory, and -h means human-readable sizes (Gi, Mi) instead of a raw number of bytes. Look at the available column, not free: Linux uses spare memory to cache files and gives it back the moment a program needs it, so free always looks small. nproc prints the number of CPUs. df -h / shows how big the main disk is and how much of it is used. The / is the top of the filesystem, which lesson 4 covers.
Try it
- How much memory is available right now?
- How much space is left on
/? - Run
freewithout-h. What unit is it using?
Answer
- The number in the
availablecolumn offree -h, a little under 4 GB on a 4 GB machine. - The
Availcolumn ofdf -h /. - Kibibytes (units of 1,024 bytes). That's why
-hexists.
uptime: how long it's been running
$ uptime
08:28:03 up 23 min, 1 user, load average: 0.00, 0.00, 0.00uptime shows the time, how long the machine has been up since it last started, how many users are logged in, and the load average: how busy the CPUs were over the last 1, 5 and 15 minutes. Lesson 16 explains load properly. For now, a number well below your CPU count means the machine is mostly idle.
Try it
- Stop and start the VM, then run
uptimeagain. What changed?
Answer
The "up" time starts again from zero minutes, because the machine restarted.
Keep it up to date
Ubuntu installs software from online archives, and the tool for that is apt. Changing the system needs administrator rights, so you put sudo in front, which runs the command as root, the administrator account. Lesson 3 covers sudo properly.
First refresh the list of what's available:
$ sudo apt update
Hit:1 http://security.ubuntu.com/ubuntu resolute-security InRelease
Hit:2 http://archive.ubuntu.com/ubuntu resolute InRelease
Hit:3 http://archive.ubuntu.com/ubuntu resolute-updates InRelease
Hit:4 http://archive.ubuntu.com/ubuntu resolute-backports InRelease
186 packages can be upgraded. Run 'apt list --upgradable' to see them.apt update doesn't install anything. It only downloads the latest list of packages and versions. To see what could be upgraded:
$ apt list --upgradable
apparmor/resolute-updates 5.0.2-0ubuntu1~26.04.1 arm64 [upgradable from: 5.0.0~beta1-0ubuntu7]
apport-core-dump-handler/resolute-updates 2.34.1-0ubuntu0.1 all [upgradable from: 2.34.0-0ubuntu2]
apport/resolute-updates 2.34.1-0ubuntu0.1 all [upgradable from: 2.34.0-0ubuntu2]
base-files/resolute-updates 14ubuntu6.2 arm64 [upgradable from: 14ubuntu6.1]
bind9-dnsutils/resolute-updates,resolute-security 1:9.20.24-1ubuntu0.4 arm64 [upgradable from: 1:9.20.18-1ubuntu2.1]
bind9-host/resolute-updates,resolute-security 1:9.20.24-1ubuntu0.4 arm64 [upgradable from: 1:9.20.18-1ubuntu2.1]
...When a list is longer than your screen, apt opens it in a pager: scroll with the arrow keys and press q to quit.
Then install every upgrade:
$ sudo apt upgrade
Upgrading:
apparmor libpython3.14-minimal
apport libpython3.14-stdlib
apport-core-dump-handler libsgutils2-1.48
...
Summary:
Upgrading: 181, Installing: 7, Removing: 0, Not Upgrading: 5
131 standard LTS security updates
Download size: 505 MB
Space needed: 577 MB / 17.1 GB available
└─ in /boot: 134 MB / 737 MB available
Continue? [Y/n]It lists what it will change and asks Continue? [Y/n]. Press Enter to say yes. Do this every few days, and always before you install something new.
Installing a program works the same way. tree draws folders as a tree:
$ sudo apt install -y tree The following package was automatically installed and is no longer required: pollinate Use 'sudo apt autoremove' to remove it. Installing: tree Summary: Upgrading: 0, Installing: 1, Removing: 0, Not Upgrading: 9 Download size: 52.7 kB Space needed: 162 kB / 16.9 GB available Get:1 http://archive.ubuntu.com/ubuntu resolute/universe arm64 tree arm64 2.3.1-1 [52.7 kB] Fetched 52.7 kB in 1s (74.4 kB/s) Selecting previously unselected package tree. (Reading database ... 97311 files and directories currently installed.) Preparing to unpack .../tree_2.3.1-1_arm64.deb ... Unpacking tree (2.3.1-1) ... Setting up tree (2.3.1-1) ... ... $ tree /etc/apt /etc/apt ├── apt.conf.d │ ├── 01-vendor-ubuntu │ ├── 01autoremove │ ├── 10periodic │ ├── 15update-stamp │ ├── 20apt-esm-hook.conf │ ├── 20archive │ ├── 20auto-upgrades │ ├── 20packagekit │ ├── 20snapd.conf │ ├── 50appstream │ ├── 50command-not-found │ ├── 50unattended-upgrades │ ├── 70debconf │ ├── 99needrestart │ └── 99update-notifier ├── auth.conf.d ├── keyrings ├── preferences.d │ ├── ubuntu-pro-esm-apps │ └── ubuntu-pro-esm-infra ├── sources.list ├── sources.list.d │ └── ubuntu.sources └── trusted.gpg.d ├── ubuntu-keyring-2012-cdimage.gpg └── ubuntu-keyring-2018-archive.gpg 7 directories, 21 files
-y answers yes to the question for you. On Multipass, sudo doesn't ask for a password. On WSL it asks for the one you chose during setup.
Try it
- Run
apt updatewithoutsudo. What happens? - Install
htop, run it, and quit withq.
Answer
- It fails, because only root can change the package lists:
$ apt update
Error: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
Error: Unable to lock directory /var/lib/apt/lists/
Warning: Problem unlinking the file /var/cache/apt/pkgcache.bin - RemoveCaches (13: Permission denied)
Warning: Problem unlinking the file /var/cache/apt/srcpkgcache.bin - RemoveCaches (13: Permission denied)- Install it, then run it:
$ sudo apt install -y htop $ htop
Common mistakes
- Running a command on the wrong machine.
multipasscommands only exist on your own computer. Inside the VM you get:
$ multipass list
multipass: command not foundCheck the prompt: ubuntu@linux means you're in the VM, so exit first. If a guide ever tells you to install Multipass inside Ubuntu, it means on a Linux computer of your own, not inside the VM.
- **Forgetting
sudo.** "Permission denied" or "are you root?" on anaptcommand means you left it out. - Upgrading without updating.
apt upgradeonly knows about versions from the lastapt update. Always run update first. - Taking a snapshot of a running machine. Multipass refuses. Stop it first.
- Making the VM too small. The default 5 GB disk fills up fast. If you already made one too small, delete it and launch it again with the flags above.
- Trusting old guides word for word. Many tutorials were written for older Ubuntu. If a
--versionline or an error message looks different from what they show, that's usually the Rust versions of the commands, not a mistake on your side.
Practice
Do these on your own before opening the answers. Each one uses only what's in this lesson.
- Make a second machine called
scratchwith 1 CPU, 2 GB of memory and a 10 GB disk, then confirm its size withmultipass info.
Answer
$ multipass launch 26.04 --name scratch --cpus 1 --memory 2G --disk 10G $ multipass info scratch
info shows CPUs, a memory total of about 2 GiB and a disk total of about 10 GiB.
- Without opening a shell, print the kernel release and the processor type of
scratchin one command.
Answer
$ multipass exec scratch -- uname -rmuname lets you join flags, so -rm is the same as -r -m. It prints both on one line.
- Open a shell in
scratchand find its Ubuntu version and codename, its available memory and its free disk space.
Answer
$ multipass shell scratch ubuntu@scratch:~$ cat /etc/os-release ubuntu@scratch:~$ free -h ubuntu@scratch:~$ df -h /
VERSION_ID="26.04" and VERSION_CODENAME=resolute, then the available column of free -h and the Avail column of df -h /.
- Bring
scratchfully up to date and installtree.
Answer
ubuntu@scratch:~$ sudo apt update ubuntu@scratch:~$ sudo apt upgrade ubuntu@scratch:~$ sudo apt install -y tree
- Snapshot
scratchasclean, make a file calledtestin it, then restore the snapshot and prove the file is gone.
Answer
$ multipass stop scratch $ multipass snapshot scratch --name clean $ multipass start scratch $ multipass exec scratch -- touch test $ multipass exec scratch -- ls test $ multipass stop scratch $ multipass restore scratch.clean $ multipass start scratch $ multipass exec scratch -- ls
The second ls prints nothing, because the file was made after the snapshot.
- Delete
scratchcompletely so it stops using disk space, and check it's gone.
Answer
$ multipass delete scratch $ multipass list
Answer y when it asks you to confirm. Only linux is left. Older versions of Multipass kept deleted machines around in a Deleted state. If yours still lists scratch as Deleted, run multipass purge to remove it for good.
Cheat sheet
| Command | What it does |
|---|---|
multipass launch 26.04 --name linux --cpus 2 --memory 4G --disk 20G | Make an Ubuntu 26.04 VM |
multipass shell linux | Open a shell in it (starts it if needed) |
multipass list | List machines, their state and IP |
multipass info linux | Details of one machine |
multipass stop linux / start linux | Stop or start it |
multipass exec linux -- cmd | Run one command inside it |
multipass snapshot linux --name fresh | Save it (stop it first) |
multipass restore linux.fresh | Go back to a snapshot (stop it first) |
multipass delete linux | Remove it for good |
whoami | Your username |
hostname | The machine's name |
uname -r, uname -m, uname -a | Kernel release, processor type, everything |
cat /etc/os-release | Distro name, version and codename |
free -h | Memory (read the available column) |
nproc | Number of CPUs |
df -h / | Disk size and space left |
uptime | Time since boot and load average |
sudo apt update | Refresh the package lists |
sudo apt upgrade | Install all updates |
sudo apt install -y name | Install a program |