Nandishwar Singh

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

  1. What Linux is
  2. Distributions
  3. The one this course uses
  4. Ways to run Linux
  5. Set up Ubuntu with Multipass
  6. Save and restore with snapshots
  7. Or use WSL on Windows
  8. Look around your new machine
  9. Keep it up to date
  10. Common mistakes
  11. Practice
  12. 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

  1. In one sentence, what's the difference between the kernel and the rest of the system?
  2. Name two things around you that probably run Linux.
Answer
  1. 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.
  2. 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.

DistroInstalls software withGood for
UbuntuaptServers, cloud, desktops, learning
DebianaptVery stable servers. Ubuntu is built on it
Linux MintaptA desktop that feels familiar after Windows
FedoradnfThe newest software, sponsored by Red Hat
RHEL, Rocky, AlmaLinuxdnfCompany servers
ArchpacmanBuilding your system piece by piece
AlpineapkTiny containers

Most servers you'll meet at work run Ubuntu, Debian or one of the Red Hat family (RHEL, Rocky, AlmaLinux).

Try it

  1. Which two distros in the table install software the same way Ubuntu does?
  2. You join a company whose servers run Rocky Linux. Which command will you use to install software there?
Answer
  1. Debian and Linux Mint, with apt. Mint is built on Ubuntu, and Ubuntu is built on Debian.
  2. 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

  1. When did Ubuntu 24.04 come out, and is it an LTS?
  2. Is Ubuntu 25.10 an LTS? Would you put it on a server you need to keep for three years?
Answer
  1. April 2024, and yes: April releases in even years are LTS.
  2. 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:

OptionWhat it isWorth knowing
MultipassA free tool from Canonical, the company behind Ubuntu, that makes Ubuntu virtual machines with one commandWorks on Mac, Windows and Linux, and it's easy to reset. This course uses it
WSLLinux built into WindowsFast and handy, but networking, disks and startup work differently from a real server
A cloud serverA machine you rent by the monthThe real thing. Lesson 30 sets one up
Your own hardwareAn 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

  1. You're on Windows and want everything in this course to behave exactly as it would on a server. Multipass or WSL?
  2. What happens to your own computer's files if you delete everything inside the VM?
Answer
  1. Multipass. WSL is fine for most lessons, but the networking, disk and service lessons behave differently there.
  2. 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:

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 20G

The 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 linux

The 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:

CommandWhat it does
multipass listShows your machines, whether they're running, and their IP addresses
multipass info linuxShows one machine's details: CPUs, memory and disk use, Ubuntu version
multipass stop linuxShuts the machine down
multipass start linuxStarts it again
multipass exec linux -- whoamiRuns one command inside it without opening a shell
multipass delete linuxDeletes the machine for good, after asking you to confirm

Try it

  1. Exit the VM, run multipass list, and find your machine's IP address.
  2. Stop the machine and run multipass list again. Then run multipass shell linux. Does it still work?
  3. 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
ubuntu

Save 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

  1. Take a snapshot called fresh.
  2. Start the machine, create a file with touch oops, and check it's there with ls.
  3. Restore fresh, then check whether oops still 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 --install

Restart 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

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

  1. Run whoami on 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

  1. Print just the kernel name. It's the default, so try uname with no flags.
  2. Is your VM an ARM or an x86 machine?
Answer
$ uname
Linux

For 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-logo

cat 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:       resolute

Try it

  1. Which codename does your VM print?
  2. cat prints any text file. Print /etc/hostname. What's in it?
Answer
  1. resolute, from VERSION_CODENAME.
  2. The machine's name:
$ cat /etc/hostname
linux

free, 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

  1. How much memory is available right now?
  2. How much space is left on /?
  3. Run free without -h. What unit is it using?
Answer
  1. The number in the available column of free -h, a little under 4 GB on a 4 GB machine.
  2. The Avail column of df -h /.
  3. Kibibytes (units of 1,024 bytes). That's why -h exists.

uptime: how long it's been running

$ uptime
 08:28:03 up 23 min,  1 user,  load average: 0.00, 0.00, 0.00

uptime 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

  1. Stop and start the VM, then run uptime again. 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

  1. Run apt update without sudo. What happens?
  2. Install htop, run it, and quit with q.
Answer
  1. 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)
  1. Install it, then run it:
$ sudo apt install -y htop
$ htop

Common mistakes

$ multipass list
multipass: command not found

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

Practice

Do these on your own before opening the answers. Each one uses only what's in this lesson.

  1. Make a second machine called scratch with 1 CPU, 2 GB of memory and a 10 GB disk, then confirm its size with multipass 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.

  1. Without opening a shell, print the kernel release and the processor type of scratch in one command.
Answer
$ multipass exec scratch -- uname -rm

uname lets you join flags, so -rm is the same as -r -m. It prints both on one line.

  1. Open a shell in scratch and 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 /.

  1. Bring scratch fully up to date and install tree.
Answer
ubuntu@scratch:~$ sudo apt update
ubuntu@scratch:~$ sudo apt upgrade
ubuntu@scratch:~$ sudo apt install -y tree
  1. Snapshot scratch as clean, make a file called test in 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.

  1. Delete scratch completely 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

CommandWhat it does
multipass launch 26.04 --name linux --cpus 2 --memory 4G --disk 20GMake an Ubuntu 26.04 VM
multipass shell linuxOpen a shell in it (starts it if needed)
multipass listList machines, their state and IP
multipass info linuxDetails of one machine
multipass stop linux / start linuxStop or start it
multipass exec linux -- cmdRun one command inside it
multipass snapshot linux --name freshSave it (stop it first)
multipass restore linux.freshGo back to a snapshot (stop it first)
multipass delete linuxRemove it for good
whoamiYour username
hostnameThe machine's name
uname -r, uname -m, uname -aKernel release, processor type, everything
cat /etc/os-releaseDistro name, version and codename
free -hMemory (read the available column)
nprocNumber of CPUs
df -h /Disk size and space left
uptimeTime since boot and load average
sudo apt updateRefresh the package lists
sudo apt upgradeInstall all updates
sudo apt install -y nameInstall a program