Overview
This guide walks you through the complete setup of Windows Subsystem for Linux (WSL) on Windows. It covers the installation of WSL2, the setup of a Linux distribution, and the essential commands to get started.
WSL2 is a lightweight, Hyper-V–based virtualized Linux environment, tightly integrated with Windows. You get the benefits of using popular Linux distributions (Ubuntu, Debian, Kali…) and their tools while staying within your Windows environment.
This allows you to have a separate environment for testing, run scripts, create automations and much more!
0️. Prerequisites
Requirements:
- Windows 10+
- Virtualization (Intel VT-x / AMD-V) enabled in your system’s firmware settings (UEFI or the legacy BIOS)
Check if virtualization is enabled:
systeminfo | find "Virtualization"If it’s disabled, we have to enable it by editing the firmware!
If you don’t know how to get there, check out how to enter the UEFI-BIOS.
NOTE
Virtualization support is determined exclusively by the CPU. It is independent of whether the system firmware is legacy BIOS or UEFI.
Enable Firmware CPU virtualization
Now that you are inside your system’s UEFI/BIOS, you have to find the option for enabling CPU virtualization.
Here’s a list of the main manufacturers and how to enable it:
| PC Manufacturer | Link |
|---|---|
| Acer | How to Enable Virtualization Technology on Acer Products |
| Asus | For AMD processors: How to enable or disable AMD Virtualization (AMD-V™) technology? For Intel processors: How to enable Intel(VMX) Virtualization Technology in the BIOS? How to enable or disable Intel® Virtualization Technology (VT-x)? |
| Dell | How To Enable or Disable Hardware Virtualization on Dell Systems |
| HP | HP PCs - Enable Virtualization Technology in the BIOS |
| Lenovo | How to enable Virtualization Technology on Lenovo PC computers |
| Microsoft | Virtualization is already enabled on Surface devices. |
1️. WSL Installation
Open PowerShell as Administrator:
wsl --installThis command enables the required Windows features, installs WSL2, and automatically installs Ubuntu.
A reboot is required for the changes to take effect. After reboot, Ubuntu will start automatically and you will be prompted to create a username and password for your new OS.
2️. Verify the Installation
Check that you are running WSL Version 2:
wsl --versionIf you are not on WSL2, upgrade with:
wsl --set-version Ubuntu 2And… that’s it!
3️. Accessing the File Systems
WSL allows access to both Windows and Linux file systems. Here’s how you can access them:
| Location | Path | Description |
|---|---|---|
| WSL filesystem (from Windows) | \\wsl$\<DISTRO_NAME>\ | The WSL FS is exposed as a virtual network share |
| Windows filesystem (from WSL) | /mnt/c/ | Automatic mount of Windows drives inside WSL |
TIP
Best practice: Avoid working directly under
/mnt/cfor I/O-intensive workloads (e.g. managing a Git repo), as performance is slower! Use/mnt/cmainly for Windows file access and exchange and prefer storing code and projects inside the WSL filesystem for optimal performance.
4️. Basic Commands
| Command | Description |
|---|---|
wsl | Enter WSL (default distro). Add -d <DISTRO_NAME> to enter a specific one |
wsl --update | Update WSL |
wsl --status | Check WSL status |
wsl --shutdown | Stop all running WSL instances |
wsl -l -v | List all installed distros with their WSL version and state |
wsl --list --online | List all available distros to install |
wsl --install -d <DISTRO_NAME> | Install a specific distro |
wsl --set-default <DISTRO_NAME> | Set the default distro |
5️. Interoperability
WSL allows you to call Windows executables directly from the Linux shell. Any .exe in the Windows PATH is accessible from WSL.
| Command | Description |
|---|---|
code . | Open the current directory in VS Code (via WSL Remote Extension) |
explorer.exe . | Open the current directory in Windows File Explorer |
notepad.exe <file> | Open a file with Notepad |
explorer.exe <file> | Open a file with its default Windows application |
6️. Basic Configuration
System update:
sudo apt update && sudo apt upgrade -yUseful tools:
sudo apt install -y curl wget git vim net-tools htop7️. Advanced: Backup & Restore
Backup
WARNING
The WSL environment must be fully stopped before exporting.
Template:
wsl --shutdown
$DATE = Get-Date -Format "yyyy-MM-dd_HH-mm"
wsl --export <DISTRO_NAME> <BACKUP_PATH>\<DISTRO_NAME>-$DATE.vhdx --vhdExample:
wsl --shutdown
$DATE = Get-Date -Format "yyyy-MM-dd_HH-mm"
wsl --export Ubuntu C:\backups\Ubuntu-$DATE.vhdx --vhdRestore
Template:
wsl --import <NEW_DISTRO_NAME> <INSTALL_LOCATION> <VHDX_FILE_PATH> --vhdExample:
wsl --import Ubu2 C:\WSL\Ubu2 C:\backups\Ubuntu-2026-04-30_14-00.vhdx --vhd8️. Useful Links
- WSL Official Documentation — Microsoft Learn
- Install WSL — Step-by-step official install guide
- Troubleshooting WSL — Microsoft Learn official troubleshooting page
- WSL Troubleshooting Guide — Extended guide by Microsoft
- Basic WSL Commands — Full command reference