How to Enable the Windows Subsystem for Linux (WSL) using PowerShell

Bringing Linux to Windows

Historically, developers who needed to test code on both Windows and Linux had to dual-boot their machines or run clunky, resource-heavy virtual machines via Hyper-V or VirtualBox. Microsoft revolutionized this workflow by introducing the Windows Subsystem for Linux (WSL), a native hypervisor layer that allows you to run a full Ubuntu, Debian, or Kali Linux kernel directly inside Windows, with seamless access to your C:\ drive.

While you can install WSL by clicking through the “Turn Windows features on or off” Control Panel menu, using PowerShell is significantly faster and automatically downloads the latest Ubuntu distribution by default.

Step 1: Check System Requirements

WSL 2 (the modern standard) requires Windows 10 version 1903 or higher, or Windows 11. It also requires hardware virtualization to be enabled in your computer’s BIOS/UEFI. If you have purchased a PC in the last five years, this is almost certainly enabled by default.

Step 2: The Magic PowerShell Command

Open an elevated PowerShell prompt. You must run it as an Administrator, as WSL modifies core hypervisor services.

Execute the following simple command:

wsl --install

This single command triggers a massive background process:

  1. It enables the “Virtual Machine Platform” optional Windows feature.
  2. It enables the “Windows Subsystem for Linux” optional Windows feature.
  3. It reaches out to the Microsoft Store servers, downloads the latest WSL kernel update, and installs it.
  4. It automatically downloads and installs Ubuntu (the default Linux distribution).

Step 3: Reboot and Configure

Because the command modifies the hypervisor layer, you must restart your computer for the changes to take effect.

Restart-Computer

When Windows boots back up, a Linux terminal window will automatically appear on your screen. It will spend a minute unpacking the Ubuntu installation files. Once finished, it will prompt you to create a UNIX user account and password. (This does not need to match your Windows password).

Installing Alternative Distributions

If you do not want Ubuntu and prefer a different flavor of Linux, you can see what is available on the Microsoft servers by running:

wsl --list --online

To install a specific distribution (for example, Debian), you simply append the -d flag to the install command:

wsl --install -d Debian

You can now open the “Ubuntu” or “Debian” app directly from your Windows Start Menu, giving you instant access to a full Linux terminal environment.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.