Linux Distributions and Getting a Shell: WSL, VM and Cloud

Beginner
12 min

Linux Distributions and Getting a Shell: WSL, VM and Cloud

Before you can practise a single command you need a Linux shell in front of you. This lesson explains what a Linux distribution is, how the major families differ, and walks through the three practical ways to get a terminal: Windows Subsystem for Linux, a virtual machine, and a cloud server. By the end you will have a working Ubuntu shell and know how to confirm which system you are on.

What a Distribution Is

Linux itself is only the kernel — the core program that talks to hardware, schedules processes and manages memory. A distribution (distro) bundles that kernel with a package manager, system utilities, a default shell and usually a desktop environment. All distributions run the same core commands, so what you learn on one transfers to the others; the differences are mostly in package management and release policy.

| Family | Popular distros | Package manager | Typical use | |---|---|---|---| | Debian | Debian, Ubuntu, Linux Mint | apt (.deb packages) | Servers, cloud images, desktops, WSL default | | Red Hat | RHEL, Fedora, Rocky Linux, AlmaLinux | dnf (.rpm packages) | Enterprise servers, Fedora for developers | | Arch | Arch Linux, Manjaro | pacman | Rolling release, enthusiasts | | Independent | Alpine, openSUSE | apk, zypper | Alpine is the base of most tiny Docker images |

For this course we use Ubuntu LTS (long-term support) because it is the most common cloud image, the default in WSL, and has five years of security updates. Every command shown here also works on Debian and, with dnf substituted for apt, on Fedora and Rocky Linux.

Option 1: WSL on Windows

Windows Subsystem for Linux runs a real Ubuntu userland on Windows 10 (build 19041+) and Windows 11. It starts in seconds and shares your Windows files under /mnt/c.

bash
# In PowerShell as Administrator wsl --install -d Ubuntu # Reboot, open the Ubuntu app, create a username and password, then: wsl --list --verbose # from PowerShell: shows the distro and WSL version (2 is what you want)

Inside Ubuntu, your Windows drive is available at /mnt/c/Users/<name>. Keep project files inside the Linux filesystem (~/projects) rather than under /mnt/c — file operations are dramatically faster there, and tools like npm behave correctly with Linux permissions.

Option 2: A Virtual Machine

A VM gives you a full, isolated Linux system with its own disk and network, which is the safest place to experiment with users, permissions and services.

  • Install VirtualBox (free, cross-platform) or VMware Workstation Player; on Apple Silicon Macs use UTM.
  • Download the Ubuntu Server ISO (no desktop, closer to what you will meet in production) or Ubuntu Desktop if you prefer a GUI.
  • Allocate 2 CPUs, 2–4 GB RAM and a 20 GB dynamically sized disk, boot from the ISO and follow the installer. Tick "Install OpenSSH server" so you can practise remote logins from your host.

Take a snapshot after installation. When you break something while learning — and you will — you can roll back in seconds.

Option 3: A Cloud Server

Every cloud provider offers small Linux machines, and several have a free tier. This is the most realistic option: you connect over SSH exactly as you would to a production server.

bash
# Typical first connection to a freshly created Ubuntu VM ssh -i ~/.ssh/my-key.pem ubuntu@203.0.113.10 # Default usernames vary by image # Ubuntu -> ubuntu Debian -> admin Amazon Linux -> ec2-user Rocky -> rocky

Cloud servers cost money and are reachable from the internet, so as soon as you have one, apply updates (sudo apt update && sudo apt upgrade) and keep the firewall lesson later in this course in mind. Destroy the instance when you finish practising.

Confirming Where You Are

Whichever route you took, run these to identify the system. You will use them constantly when debugging "works on my machine" problems.

bash
cat /etc/os-release # distro name and version uname -r # kernel version whoami # current user echo $SHELL # your login shell, usually /bin/bash hostname # machine name

Expected output on Ubuntu 24.04:

bash
PRETTY_NAME="Ubuntu 24.04.2 LTS" 6.8.0-45-generic ubuntu /bin/bash

macOS Users

macOS ships a Unix shell (zsh by default) and most commands in this course work unchanged. The differences you will notice: no apt (use Homebrew instead), BSD versions of tools like sed and ls with slightly different flags, and no systemd. For a fully faithful Linux environment, run Ubuntu in UTM or use a cloud VM.

Tips

  • Stay on an LTS release for learning and servers; interim releases and rolling distros change too often.
  • Use WSL 2, not WSL 1. WSL 1 emulates system calls and breaks some tools such as Docker.
  • Do not learn as root. Create a normal user and reach for sudo only when needed — that is how production systems are administered.
Quick Quiz
Question 1 of 3

Which part of a Linux system is actually "Linux"?

Key Takeaways

  • A distribution is the kernel plus a package manager, utilities and shell; core commands are the same everywhere.
  • Debian/Ubuntu use apt, Red Hat/Fedora use dnf, Arch uses pacman.
  • WSL 2 is the fastest way to get Ubuntu on Windows; a VM is the safest sandbox; a cloud server is the most realistic.
  • Keep project files inside the Linux filesystem, not under /mnt/c, when using WSL.
  • cat /etc/os-release, uname -r and whoami tell you exactly what system you are on.

Next lesson: Terminal Basics: Command Anatomy, Help Pages, History and Shortcuts — learn how commands, options and arguments fit together and how to find help without leaving the terminal.

Linux Distributions and Getting a Shell: WSL, VM and Cloud - Linux & Command Line | CodeYourCraft | CodeYourCraft