Home / Software / Linux / How to Run Linux on Windows Using WSL2

How to Run Linux on Windows Using WSL2

You do not need to install Linux on a separate partition or machine to use it. Windows 11 and Windows 10 both include Windows Subsystem for Linux (WSL), which lets you run a full Linux environment — including the command line and many Linux tools — directly inside Windows. This guide explains how to install and use WSL2.

What Is WSL2?

WSL2 (Windows Subsystem for Linux version 2) is a compatibility layer built into Windows that runs a real Linux kernel inside a lightweight virtual machine. Unlike the original WSL1 (which translated Linux system calls), WSL2 runs a genuine Linux kernel and has near-native performance for most workloads.

With WSL2 you can:

  • Run Linux command-line tools (bash, git, curl, grep, sed, etc.)
  • Install Linux packages with apt
  • Run Python, Node.js, Ruby and other development tools in their Linux versions
  • Access your Windows files from Linux and vice versa
  • Run Docker (the recommended way to run Docker on Windows is via WSL2)
  • Use Linux-based development workflows without leaving Windows

WSL2 does not run graphical Linux applications by default (though WSLg — included in recent versions of Windows 11 — adds GUI app support).

Requirements

  • Windows 10 version 1903 or later (build 18362+), or Windows 11
  • 64-bit processor
  • Virtualisation enabled in BIOS (usually on by default on modern PCs)
  • At least 4GB RAM (8GB+ recommended for development use)

Step 1 — Install WSL2

Microsoft has made WSL2 installation very straightforward. Open a PowerShell or Command Prompt as Administrator (right-click Start > Windows Terminal (Admin) or search for PowerShell and right-click > Run as administrator) and run:

wsl --install

This single command:

  • Enables the WSL feature
  • Enables the Virtual Machine Platform feature
  • Downloads and installs the WSL2 Linux kernel
  • Sets WSL2 as the default version
  • Downloads and installs Ubuntu as the default distribution

When the installation completes, restart your PC.

Step 2 — Set Up Your Linux User Account

After restarting, Ubuntu will launch automatically and prompt you to:

  1. Create a Linux username — this can be anything, it does not have to match your Windows username
  2. Set a Linux password — used when running commands with sudo

Once set up, you will be at a Linux bash prompt inside Ubuntu.

Step 3 — Update Ubuntu

Run the following commands to update all installed packages:

sudo apt update && sudo apt upgrade

Enter your Linux password when prompted. This is good practice after a fresh installation.

Installing a Different Linux Distribution

Ubuntu is installed by default, but you can install other distributions:

wsl --list --online

This lists available distributions including Debian, Kali Linux, openSUSE and others. Install one with:

wsl --install -d Debian

Accessing Your Windows Files from Linux

Your Windows drives are mounted automatically in WSL2 under /mnt/. For example:

  • Windows C: drive → /mnt/c/
  • Windows D: drive → /mnt/d/

You can read and write Windows files from within WSL2:

ls /mnt/c/Users/YourWindowsUsername/Desktop

Accessing Linux Files from Windows

You can access the Linux filesystem from Windows Explorer. In the Windows Explorer address bar, type:

\\wsl$

This shows your installed Linux distributions as network drives. You can browse, copy and edit Linux files from Windows. However, for performance reasons, keep project files that you work on inside Linux within the Linux filesystem (~/), not on the Windows drive.

Opening Linux from Windows Terminal

Windows Terminal (available free from the Microsoft Store) provides a tabbed terminal that integrates WSL2 nicely. You can open Ubuntu tabs alongside PowerShell and Command Prompt tabs. Click the dropdown arrow next to the new tab button to see your installed Linux distributions.

Useful WSL2 Commands

wsl --list --verbose

Shows your installed distributions and their WSL versions.

wsl --shutdown

Stops all running WSL2 instances (useful if you need to free memory).

wsl --set-default-version 2

Ensures WSL2 is the default for new distributions.

WSL2 vs Dual Booting vs a Virtual Machine

  • WSL2 — easiest, no restart required, integrates with Windows, best for development workflows. Does not run a full desktop environment (by default).
  • Dual boot — runs real Linux at full hardware performance, completely separate from Windows. Requires a restart to switch. More disruptive to set up.
  • Virtual machine (VirtualBox, VMware) — runs Linux in a window inside Windows, can run a full desktop. Slower than dual boot or WSL2 for CPU-intensive tasks.

For most developers and IT users who want Linux tools while staying on Windows, WSL2 is the best option. For a full Linux desktop experience, dual booting or a separate machine is better.

Sign Up For Daily Newsletter

Stay updated with our weekly newsletter. Subscribe now to never miss an update!

[mc4wp_form]

Leave a Reply

Your email address will not be published. Required fields are marked *