Curious Minds

Clear answers to science and history questions

How to Run WSL: Step-by-Step Guide

· 5 min read · Science

Running WSL (Windows Subsystem for Linux) means launching a Linux environment directly on Windows without a virtual machine or dual boot. Once installed, you can start it from the Start menu, a terminal, or by typing wsl in Command Prompt or PowerShell. This guide walks through the full process: checking prerequisites, installing WSL, launching your first distribution, and fixing the problems that most often stop people cold.

What You'll Need

  • Windows 10 version 2004 (build 19041) or later, or Windows 11. Older builds need manual enablement steps.
  • Administrator access to the PC for the one-time installation.
  • Virtualization enabled in BIOS/UEFI (required for WSL 2). Most modern PCs have it on by default, but it is worth checking.
  • An internet connection for downloading the Linux distribution.
  • Roughly 1–2 GB of free disk space for a typical distribution, more if you install large toolchains.

Step-by-Step

  1. Open PowerShell as Administrator. Right-click the Start button and choose “Windows PowerShell (Admin)” or “Terminal (Admin)” on Windows 11. The installation step needs elevated rights.
  2. Install WSL with one command. Type wsl --install and press Enter. This enables the required Windows features (Virtual Machine Platform and the WSL optional component), downloads the latest WSL kernel, sets WSL 2 as the default, and installs Ubuntu. Wait for it to finish.
  3. Restart the computer. A reboot is required for the Windows features to take effect. Save your work first.
  4. Let Ubuntu finish setting up. After the restart, Ubuntu may open automatically. If it does not, launch “Ubuntu” from the Start menu. A console window appears and asks you to create a UNIX username and password. The password does not echo as you type — that is normal.
  5. Verify the installation. Open PowerShell and run wsl --list --verbose (or wsl -l -v). You should see your distribution listed with version 2. If it shows version 1, run wsl --set-version Ubuntu 2.
  6. Launch WSL whenever you need it. From the Start menu, click your distribution’s icon. From any terminal, type wsl to enter the default distribution, or wsl -d Ubuntu to target a specific one. To run a single command without entering the shell, use wsl ls -la or similar.
  7. Update the Linux packages. Inside the WSL shell, run sudo apt update && sudo apt upgrade -y (for Ubuntu/Debian). This keeps the environment current and avoids package errors later.
  8. Access Windows files from Linux. Your Windows drives are mounted under /mnt/c, /mnt/d, and so on. For example, cd /mnt/c/Users/YourName takes you to your Windows user folder.
  9. Access Linux files from Windows. In File Explorer, type \\wsl$\ in the address bar and press Enter. You can also use \\wsl.localhost\ on newer builds. This opens your Linux home directory.
  10. Shut down WSL cleanly when needed. WSL runs in the background. To stop all distributions, run wsl --shutdown in PowerShell. This is useful after configuration changes or when the environment becomes unresponsive.

Common Mistakes

  • Skipping the restart. The wsl --install command often appears to succeed but the distribution will not launch until Windows reboots.
  • Forgetting the UNIX password. The Linux password is separate from your Windows password. If you lose it, you can reset it by entering the distribution as root with wsl -u root and running passwd yourusername.
  • Editing Linux files with Windows tools. Using Notepad or other Windows editors on files inside the Linux filesystem can corrupt permissions and line endings. Edit Linux files from inside WSL, and Windows files from Windows.
  • Assuming WSL 2 is active. Some older setups default to WSL 1. Check with wsl -l -v and convert if needed.
  • Ignoring virtualization. If wsl --install fails with a virtualization error, the feature is disabled in firmware. Enable Intel VT-x or AMD-V in BIOS/UEFI.
  • Running wsl from a non-admin prompt during first install. The initial enablement needs elevation; later launches do not.

Tips

  • Set a default distribution with wsl --set-default Ubuntu if you install more than one.
  • Use Windows Terminal for a better experience: it supports multiple tabs, including PowerShell and WSL side by side.
  • Keep projects on the Linux side (~/projects) rather than under /mnt/c for much faster file operations, especially with tools like Git and Node.js.
  • Install wslu (a set of utilities) inside Ubuntu to open Windows apps and browsers from Linux with commands like wslview.
  • Back up your distribution occasionally with wsl --export Ubuntu backup.tar and restore with wsl --import.
  • Check for WSL updates with wsl --update; the kernel is updated separately from Windows.

Troubleshooting

  • “WSL 2 requires an update to its kernel component.” Run wsl --update in an admin PowerShell. If that fails, download the kernel update package from Microsoft’s WSL documentation page and install it manually.
  • “The Windows Subsystem for Linux optional component is not enabled.” Open “Turn Windows features on or off”, tick “Windows Subsystem for Linux” and “Virtual Machine Platform”, reboot, then retry.
  • Virtualization error. Enter BIOS/UEFI and enable virtualization (Intel VT-x or AMD-V). On some laptops it is labelled “SVM” or “Vanderpool”.
  • Distribution launches but hangs. Run wsl --shutdown, then relaunch. If it persists, export your data and reinstall the distribution.
  • Forgotten password. Launch with wsl -u root, then passwd <username> to set a new one.
  • Networking issues. WSL 2 uses a virtual network. If DNS fails, check /etc/resolv.conf and consider disabling the auto-generated file via /etc/wsl.conf. Restart WSL after changes.
  • “No installed distributions.” The install may have failed silently. Run wsl --install -d Ubuntu explicitly, or list available distributions with wsl --list --online.

Frequently Asked Questions

Do I need a separate Linux installation?

No. WSL runs a real Linux kernel in a lightweight virtualized layer managed by Windows. You do not dual boot or install a full Linux OS separately.

Is WSL the same as a virtual machine?

No. WSL 2 uses a lightweight utility VM behind the scenes, but it integrates tightly with Windows: you can run Windows executables from Linux and access both filesystems directly. A traditional VM runs a full guest OS with its own boot process.

Can I run graphical Linux apps?

Yes, on Windows 11 and recent Windows 10 builds, WSL supports GUI apps through WSLg without extra setup. Launch them from the Linux shell and a window appears.

How do I uninstall WSL?

Run wsl --unregister <DistributionName> to remove a distribution and its data, then optionally disable the Windows features. Unregistering deletes files, so export first if you need them.

Does WSL work on Windows 10 Home?

Yes, on version 2004 (build 19041) and later. Earlier builds required manual feature enablement and had more limitations.

Where are my Linux files stored?

Inside a virtual disk file (ext4.vhdx) under your user profile’s AppData folder. Access them from Windows via \\wsl$\ rather than browsing the virtual disk directly.

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions