WSL (Windows Subsystem for Linux) is a Microsoft feature that allows you to run a Linux distribution directly in Windows — without a virtual machine and without dual-boot. For developers who need Linux tools (bash, apt, Docker) alongside Windows applications, WSL is an ideal solution. In this article, we will look at how to install Ubuntu on WSL step by step.
What is WSL?
WSL is a compatibility layer in Windows 10 and 11 that allows running Linux programs directly in Windows. There are two versions:
| Version | Description | Use |
|---|---|---|
| WSL 1 | Translates Linux system calls into Windows calls | Legacy, not recommended |
| WSL 2 | Real Linux kernel in a lightweight virtual machine | Recommended, faster, full compatibility |
WSL 2 runs a real Linux kernel, which means full compatibility with Linux applications, including Docker.
Requirements
Before starting, check whether your computer meets the requirements:
- Windows 10 version 2004 or newer (build 19041+) or Windows 11
- Virtualization enabled in BIOS/UEFI: WSL 2 requires VT-x (Intel) or AMD-V (AMD)
- At least 4 GB RAM (8 GB recommended)
You can check your Windows version with the winver command (Win + R → winver).
Installing WSL
The easiest way to install is via the command line. Open PowerShell as administrator (right-click → Run as administrator) and run:
# Install WSL with the default Ubuntu distribution wsl --install
This command does the following:
- Enables WSL components and the virtual machine platform
- Downloads and installs the latest Linux kernel
- Sets WSL 2 as the default version
- Installs Ubuntu as the default distribution
After running the command, restart your computer. After restart, Ubuntu will open automatically and ask you to set up a username and password.
Installing Another Distribution
If you want to install a different distribution, not just Ubuntu, first list the available ones:
# List available distributions wsl --list --online # Install a selected distribution (example: Debian) wsl --install -d Debian # Install a specific version of Ubuntu wsl --install -d Ubuntu-24.04
First Launch and Setup
After restart, open Ubuntu from the Start menu (search for "Ubuntu"). The first launch takes longer because the installation is still in progress. Ubuntu will ask you:
- Username: Choose a name without spaces. You will use this name to log into Ubuntu and for sudo commands
- Password: Enter the password twice. The password is not displayed while typing — this is normal
After successful setup, you are in the Ubuntu terminal! Ready to work.
Basic WSL Commands
Here is an overview of the most important commands for working with WSL:
| Command | Description | Example |
|---|---|---|
| wsl --status | Shows the WSL status | wsl --status |
| wsl --list --verbose | Lists all installed distributions and their WSL version | wsl -l -v |
| wsl --set-default-version 2 | Sets WSL 2 as the default | wsl --set-default-version 2 |
| wsl --shutdown | Stops all WSL distributions | wsl --shutdown |
| wsl --update | Updates the WSL Linux kernel | wsl --update |
| wsl --unregister <distro> | Removes a distribution and all its data (WARNING: deletes everything!) | wsl --unregister Ubuntu |
Accessing Files Between Systems
One of the best features of WSL is that you can access files in both systems:
| Access | Path | Note |
|---|---|---|
| From Linux to Windows | /mnt/c | cd /mnt/c/Users/name/Documents |
| From Windows to Linux | \\wsl$\Ubuntu | Type it in the Explorer address bar |
Windows Terminal
For a more pleasant experience with WSL, I recommend installing Windows Terminal from the Microsoft Store. It offers:
- Tabs — you can have multiple terminals open at the same time
- Customizable themes and profile colors
- Split view — two terminals at once
- A separate profile for each WSL distribution
Practical Tips
- Keep projects in the Linux file system: For faster work with git, npm, or other tools, keep your project code in the Linux file system (home folder ~), not on /mnt/c. Cross-system access is noticeably slower
- VS Code + WSL: Install the WSL extension for VS Code — you can open a project in the Linux file system directly from VS Code
- GUI applications: WSL 2 also supports Linux graphical applications (WSLg) — without installing an additional X server
- No Samba needed: Windows Explorer can access Linux files via the \\wsl$\Ubuntu path
How to Turn Off WSL
WSL consumes RAM, so it is wise to shut it down when you don't need it:
# Stop all distributions and WSL wsl --shutdown # Check whether it is running wsl --list --verbose
IMPORTANT: The command wsl --unregister Ubuntu completely deletes the distribution along with all files. Make a backup before using it!
Conclusion
WSL is an excellent solution for developers who need both Windows and Linux. Installation is simple, it runs fast, and it offers full compatibility with Linux tools. Whether you develop web applications, scripts, or Docker containers — Ubuntu on WSL gives you Linux power within Windows.