Beginner guide

Practise Linux on Windows with WSL2

Install Ubuntu on WSL2, practise in your Linux home folder, manage resources, and understand where a full desktop differs.

Beginner Updated

Documentation reviewed; device validation pending

You can practise Linux commands while keeping Windows as your everyday system. Start with Ubuntu on Windows Subsystem for Linux 2 (WSL2) for terminal work. You do not need to install VirtualBox or a Linux desktop to begin.

WSL2 uses a lightweight virtual machine managed by Windows. It still needs memory, disk space and hardware virtualization. This is a practical starting route for terminal learning, not a guarantee of performance on every laptop. See Microsoft’s WSL architecture comparison.

What you want to do Environment
Practise shell commands while staying on Windows Follow the WSL2 steps below.
Use an existing Ubuntu installation Open its terminal and continue at Safe Setup.
Explore a complete Linux desktop, its settings or a separate guest Use the Ubuntu desktop VM guide if your PC has the resources.
Prepare to replace Windows Follow Switch to Linux; WSL terminal practice does not test hardware or installation compatibility.

Check your Windows setup

This walkthrough uses a personal Windows 11 computer and Ubuntu 24.04 LTS on WSL2. Check Settings > System > About and available space under System > Storage. On a managed computer, ask the administrator before enabling features or installing a distribution. Keep Windows backup and recovery ready before host changes.

WSL2 requires virtualization. Follow Microsoft’s virtualization instructions if it is disabled; keep security protections enabled. If the machine cannot support WSL2, this guide does not require you to force it or create a heavier VM.

In Windows PowerShell, inspect an existing installation:

wsl --status
wsl --version
wsl --list --verbose

If Ubuntu is already listed with VERSION 2, reuse it rather than reinstalling it. Use its exact listed name in the launch command below. Missing WSL, a help screen or an unsupported option means setup or an update is needed; it does not mean your files should be reset. Follow Microsoft’s installation troubleshooting for an error.

Install Ubuntu on WSL2

Save your work. Open PowerShell as administrator. Check the available distribution names:

wsl --list --online

If Ubuntu-24.04 is available and you do not already have it, install it:

wsl --install -d Ubuntu-24.04

This enables required Windows components and installs the distribution. Restart Windows when requested. New installations use WSL2 by default. If the list or installation fails, retain the error and use Microsoft’s install guide; do not unregister an existing distribution as a repair shortcut. Canonical documents the versioned distribution names in Install Ubuntu on WSL2.

Launch Ubuntu 24.04 from Start and finish creating your Linux username and password. These belong to Ubuntu, separately from your Windows account. Password characters are not displayed as you type; that is expected. See Microsoft’s account setup.

Back in a normal PowerShell window, run wsl --list --verbose again. Confirm the intended distribution says 2 in the VERSION column. If an existing distribution says 1, review and back it up before considering conversion; do not silently convert it for this course.

Open the Linux shell and create your workspace

From PowerShell, launch the chosen distribution in its Linux home directory:

wsl ~ -d Ubuntu-24.04

Use your actual listed distribution name if different. The prompt is now a Linux shell. Run the following there, not in PowerShell, Command Prompt or Git Bash:

bash
cd ~
pwd
cat /etc/os-release

pwd should show your Linux home directory under /home/, and the release information should identify Ubuntu. Keep course files in ~/linux-practice, rather than /mnt/c/Users/.... Microsoft recommends the Linux filesystem for Linux command-line work. Windows drives are accessible from WSL: it is not an isolated disposable sandbox, and commands can affect files outside your practice folder.

Continue at Safe Setup for the single shared workspace command and checklist. Then try Mission 1. After closing and reopening Ubuntu, return with cd ~/linux-practice and check that your files remain. Opening a new terminal does not remove your work.

If a lesson tool is missing

Installed tools vary by Ubuntu image. Check a missing command before installing anything. For example, Mission 7 uses column, provided by Ubuntu 24.04’s bsdextrautils package:

command -v column
apt show bsdextrautils

If it is absent and you choose to add it, run these inside Ubuntu. Review APT’s proposed changes before accepting:

sudo apt update
sudo apt install bsdextrautils

This downloads package information and changes your Ubuntu installation; it is separate from removable practice files. You can defer that example instead. Other lesson tools include file, less, curl, and man-db for man, whatis and apropos. Manual pages and their search index must also be present; an empty search result does not establish a broken WSL installation.

Keep resource use manageable

Start with terminal exercises and close applications you do not need. Check Windows Task Manager if the PC becomes slow. To stop WSL when finished, save Linux work and stop any jobs first, then run this in PowerShell:

wsl --shutdown

This stops all running WSL distributions and can interrupt tools such as Docker that use WSL. Relaunch Ubuntu to continue later; shutdown does not erase its files. The WSL command reference also describes terminating an individual distribution.

For an optional memory cap, use WSL Settings or edit the existing %UserProfile%\.wslconfig on Windows after keeping a copy. A small terminal-only starting example is:

[wsl2]
memory=2GB

This is an example cap, not a minimum, recommendation for every PC or measured course requirement. Do not overwrite other settings or duplicate an existing [wsl2] section. Limits apply across WSL2 distributions and may affect Docker or other work. Save work, shut down WSL, then relaunch to apply a change; restore the earlier setting if it is unsuitable. See Microsoft’s WSL configuration reference.

Understand the course differences

Practise inside the Linux home filesystem and read each command’s safety label. The lessons’ shell, text, file and scripting exercises are the starting point. APT examples belong to Ubuntu/Debian; optional administrator actions remain optional and change the installed distribution beyond the practice folder.

Example What to expect on WSL2
Navigation, file editing, permissions and shell scripts Work inside ~/linux-practice; Windows-mounted files have different permission behavior.
Storage, networking, memory and process inspection Output describes the WSL environment and can differ from a standalone PC. Do not use it to judge Linux hardware support.
System logs in Mission 24 The example checks whether systemd is running. An unavailable journal is an explained outcome; do not enable services just to reproduce a screenshot.
Scheduling in Mission 27 Use the course’s bounded simulation. A real cron job needs a running scheduler and environment; do not expect it to run while WSL is shut down.
Desktop settings, drivers, boot and device troubleshooting Use the relevant migration guide and a suitable desktop environment; terminal practice does not reproduce these conditions.

Current Ubuntu WSL installations support systemd, but existing installations can differ; see Microsoft’s systemd documentation. If a command is missing, inspect its lesson context and the package before installing anything. This page is documentation-reviewed; no Windows/WSL device run or complete-course execution is claimed.

Keep practice cleanup separate from environment removal

Practice cleanup removes only the files you choose inside Linux. It does not uninstall Ubuntu, WSL, packages or Windows features. Course progress belongs to the browser profile you use; preserve it too if that browser runs inside an environment you intend to remove.

To stop for the day, shut down WSL after saving your work. To remove a distribution permanently, first preserve its data outside that distribution and verify the copy. Microsoft’s export and unregister instructions explain the distinction: unregistering destroys that distribution’s data, settings and software. Do not use it as a cleanup command or copy a distribution name from an example without checking it.

Keep WSL and virtualization features if Docker, another distribution or another application uses them. If you chose the full desktop route instead, use its VM removal instructions.

Discussion

Continue the conversation about this guide. Loading comments connects to GitHub Discussions through giscus.

Open community discussions on GitHub

Check before you copy

This command needs care. Read its context, confirm the target and location, and keep a recovery path.

Copying does not run a command.