How to Install WSL in Windows
Here’s the clean, correct way to install WSL (Windows Subsystem for Linux) on Windows. This guide covers the modern one-command method first (recommended), then the manual fallback.
✅ Recommended Method (Windows 10 21H2+ / Windows 11)
1️⃣ Open PowerShell as Administrator
- Press Start
- Type PowerShell
- Right-click → Run as administrator
2️⃣ Run this single command
wsl --install
What this does automatically:
- Enables WSL
- Enables Virtual Machine Platform
- Installs WSL 2
- Installs Ubuntu (default distro)
- Sets WSL 2 as default
👉 Reboot when prompted
3️⃣ Launch Linux
After reboot:
- Open Start
- Search Ubuntu
- First launch will ask you to:
- Create a Linux username
- Create a password
🎉 Done. You now have a full Linux environment.
🔍 Verify Installation
wsl --status
You should see:
- Default version: 2
- Installed distribution: Ubuntu
📋 Common WSL Commands
Install a specific distribution
wsl --install -d <DistroName>
List available distributions
wsl --list --online
Set default distribution
wsl --set-default <DistroName>
Set default version
wsl --set-default-version 2
Uninstall a distribution
wsl --unregister <DistroName>
Update WSL
wsl --update
Shutdown WSL
wsl --shutdown
🔄 File Access
Access Windows files from WSL
cd /mnt/c/Users/<username>
Access WSL files from Windows
\\wsl$\<DistroName>
🛠️ Advanced Commands
Run a command in WSL
wsl <command>
Run a command in a specific distribution
wsl -d <DistroName> <command>
Run a command as a specific user
wsl -u <username> <command>
Export a distribution
wsl --export <DistroName> <FileName>
Import a distribution
wsl --import <DistroName> <InstallLocation> <FileName>
Terminate a distribution
wsl --terminate <DistroName>
List running distributions
wsl --list --running
List all distributions
wsl --list --all
List verbose
wsl --list --verbose