If you’ve ever wanted to run Linux on your Windows machine without installing a virtual machine or dual-booting, WSL2 (Windows Subsystem for Linux 2) is here to make your life easier. Microsoft introduced WSL to bridge the gap between Windows and Linux, and WSL2 takes it a step further by offering a real Linux kernel inside Windows. This makes it faster, more powerful, and more compatible than its predecessor.
In this beginner-friendly guide, we’ll walk through what WSL2 is, why it’s useful, and how you can get started with it.
What Is WSL2?
WSL2 stands for Windows Subsystem for Linux (Version 2). It’s a compatibility layer created by Microsoft that allows you to run Linux distributions natively on Windows 10 and Windows 11. Unlike the first version (WSL1), which translated Linux system calls into Windows system calls, WSL2 actually uses a lightweight virtual machine with a real Linux kernel.
This means you get better performance, full system call compatibility, and the ability to run tools like Docker natively within Linux.
WSL2 vs. WSL1
- WSL1: Uses a compatibility layer to mimic Linux — great, but not perfect; some programs didn’t work.
- WSL2: Runs a real Linux kernel in a lightweight VM; better compatibility, faster, and supports more advanced features like running Docker natively.
Why Use WSL2?
Here are some key benefits of WSL2:
- Performance Boost: File system operations and commands run much faster than in WSL1.
- Real Linux Kernel: Enables running more Linux apps, servers, and development tools.
- Docker Support: You can run Docker Desktop with WSL2 without needing heavy virtual machines.
- Developer Friendly: Perfect for developers working on cross-platform projects.
- Seamless Integration: Access Linux files from Windows and vice versa.
How to Install WSL2
Installing WSL2 is simple. Let’s walk through the steps:
Prerequisite
First, open PowerShell as an administrator, then run:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
This command turns on the WSL feature.
Still in PowerShell, enter:
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
This allows Windows to run the virtualization tech WSL2 needs.

You can do this in Windows by searching for “Turn Windows features on or off,” then find the respective feature and enable it.
Step 1: Enable WSL
Open PowerShell as Administrator and run:
wsl - install
This command installs WSL and sets WSL2 as the default version.
If you already have WSL installed, you can update it to WSL2 with:
wsl - set-default-version 2
Step 2: Install a Linux Distribution
After enabling WSL2, you need to install a Linux distribution (like Ubuntu). You can get it from the Microsoft Store:
- Open Microsoft Store
- Search for Ubuntu, Debian, or another preferred distro
- Click Install
Step 3: Launch Linux
Once installed, open your distribution by searching it in the Start Menu. The first time you launch it, you’ll be asked to create a username and password for your Linux environment.
Using WSL2: Basic Commands
Here are a few useful commands to manage WSL2:
- List installed distributions:
wsl - list - verbose
This shows your installed distros and whether they’re using WSL1 or WSL2.
- Set default distribution:
wsl - set-default <DistroName>
- Switch a distro to WSL2:
wsl - set-version <DistroName> 2
- Access Linux from Windows: You can find Linux files in Windows Explorer under:
1. Open File Explorer.
2. Type \\wsl$\Ubuntu
in the address bar.
3. Press Enter → you’ll see your Linux files (/home
, /etc
, etc.) from Windows.
// or use below command
explorer.exe .
- Run Linux commands directly in PowerShell:
wsl ls -la
ls
→ lists files and directories.-l
→ shows a long listing format (permissions, owner, group, size, modified date).-a
→ shows all files, including hidden ones (those starting with a.
like.bashrc
).
Means,
Run the Linux command ls -la
inside WSL from Windows PowerShell/Command Prompt.
It will list the contents of your Linux home directory (~
) by default, with detailed info and hidden files.
drwxr-xr-x 1 user user 4096 Aug 18 09:00 .
drwxr-xr-x 1 root root 4096 Aug 18 08:55 ..
-rw-r--r-- 1 user user 220 Aug 18 08:55 .bash_logout
-rw-r--r-- 1 user user 3771 Aug 18 08:55 .bashrc
drwx------ 2 user user 4096 Aug 18 09:01 .ssh
Key difference:
- Inside a WSL shell (Ubuntu, Debian, etc.):
ls -la
runs directly because you’re already in a Linux environment.
- From Windows PowerShell or Command Prompt (without entering WSL):
wsl ls -la
tells Windows to invoke the ls -la
command inside the default WSL distribution.
Extra notes:
- If you have multiple distros installed, you can specify which one with:
wsl -d Ubuntu-22.04 ls -la
- If you want to just enter the WSL shell instead of running one-off commands:
wsl
Tip: Keep your WSL2 and Linux distribution updated regularly using:
sudo apt update && sudo apt upgrade
Example: Running a Web Server on WSL2
Let’s say you want to run a simple web server using Python inside WSL2:
Open your Linux terminal (e.g., Ubuntu)
Navigate to your project folder:
cd ~/myproject
Start a simple Python HTTP server:
python3 -m http.server 8080
Open your browser in Windows and visit:
http://localhost:8080
And just like that, your Linux-based web server is accessible on Windows!
WSL2 vs. Virtual Machines
A common question is: Why not just use VirtualBox or VMware?
- Lightweight: WSL2 uses fewer resources than full virtual machines.
- Faster Startup: No need to boot an entire OS.
- Tighter Integration: Access files seamlessly between Windows and Linux.
If you need a full Linux desktop experience, a VM might still be better. But for most developers, WSL2 is more than enough.
Conclusion
WSL2 is a game-changer for developers, system administrators, and anyone curious about Linux. It brings the power of Linux into Windows without the headaches of dual-booting or managing virtual machines. Whether you want to experiment with Linux commands, run development environments, or use tools like Docker, WSL2 makes it incredibly simple.
So if you haven’t tried it yet, give it a shot. With just a few commands, you’ll have the best of both worlds — Windows and Linux — running side by side.