how to run Linux on Windows using WSL

If you’re a developer, system admin, or just someone who wants to try out Linux on Windows, you’re in luck. Microsoft has made it possible to run a full-fledged Linux distribution inside Windows using WSL—the Windows Subsystem for Linux. I’ve personally used WSL for web development, running scripts, and testing server setups—all without needing a separate Linux machine or dual-boot setup. It’s fast, efficient, and deeply integrated into Windows.

This guide will walk you through how to run Linux on Windows using WSL, step by step, based on verified and practical knowledge.

What Is WSL?

WSL (Windows Subsystem for Linux) is a compatibility layer that allows Windows to run Linux binaries natively. It lets you install a Linux distribution like Ubuntu, Debian, or Kali Linux directly from the Microsoft Store.

There are two versions:

  • WSL 1 – Initial version, good for simple tasks, uses a translation layer
  • WSL 2 – Full Linux kernel via a lightweight virtual machine, supports Docker, faster file system access, and better compatibility

For most users today, WSL 2 is the recommended version.

Benefits of Using WSL

  • Run Linux commands alongside Windows apps
  • Access bash shell, apt, and Linux packages
  • Use it for web development, server-side testing, automation, and scripting
  • Avoid dual boot setups or full virtual machines
  • Easy integration with VS Code, Docker, and other dev tools

System Requirements for WSL

To use WSL 2, you need:

  • Windows 10 version 2004 or later (Build 19041+)
  • Or Windows 11 (any version)
  • Virtualization enabled in BIOS
  • An internet connection to download Linux distributions

Step-by-Step Guide to Install and Use Linux with WSL

Step 1: Enable WSL Feature

Open PowerShell as Administrator to enable WSL.

Command:

powershell

CopyEdit

wsl –install

This command installs everything required, including:

  • WSL 2
  • Virtual Machine Platform
  • Ubuntu (default Linux distro)

If this doesn’t work or you’re using an older version of Windows 10, you can enable it manually.

Alternate Manual Method:

powershell

CopyEdit

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

Then restart your computer.

Step 2: Set WSL 2 as the Default Version

Once WSL is installed, set WSL 2 as default.

Command:

powershell

CopyEdit

wsl –set-default-version 2

This ensures any future Linux distributions you install will use WSL 2.

Step 3: Install a Linux Distribution

You can now install a Linux distro from the Microsoft Store.

Common options:

  • Ubuntu (most popular and beginner-friendly)
  • Debian
  • Kali Linux
  • Fedora Remix
  • openSUSE

Steps:

  1. Open Microsoft Store
  2. Search for Ubuntu (or any other distro)
  3. Click Get to download and install

After installation, launch the distro from the Start Menu.

Step 4: Complete Initial Linux Setup

The first time you launch your Linux distribution, it will take a few moments to set up.

You’ll be prompted to:

  • Create a new UNIX username
  • Set a password (for the Linux environment)

Once set, you’ll land in the Linux terminal, ready to use commands.

Step 5: Update and Upgrade Your Linux Distro

To ensure your environment is up to date:

Run:

bash

CopyEdit

sudo apt update && sudo apt upgrade -y

This updates all installed packages to the latest versions. I do this as the first step after setting up any new system.

Step 6: Install and Use Linux Tools

You can now install any Linux command-line tools.

Examples:

bash

CopyEdit

sudo apt install git

sudo apt install python3

sudo apt install build-essential

You can also clone repos, write shell scripts, and run node apps—all inside your Windows system.

Step 7: Access Windows Files from Linux

WSL mounts your Windows file system automatically.

To access your Windows files:

bash

CopyEdit

cd /mnt/c

This command takes you to your C:\ drive. You can navigate, copy, and edit files seamlessly between Windows and Linux.

Example:

bash

CopyEdit

cd /mnt/c/Users/YourUsername/Desktop

I use this daily when working on cross-platform projects.

Step 8: Run Windows Commands from Linux and Vice Versa

WSL allows interoperability.

From Linux terminal, you can run a Windows app:

bash

CopyEdit

notepad.exe

From Command Prompt or PowerShell, you can run Linux commands:

powershell

CopyEdit

wsl ls -la

This is great for integrating tools from both environments in your workflow.

Step 9: Customize Your Terminal

For a better experience, install Windows Terminal from the Microsoft Store. It allows you to:

  • Use tabs for multiple shells
  • Change color schemes and fonts
  • Switch between PowerShell, CMD, and Linux easily

After installing, set your preferred Linux distro as the default profile.

Step 10: Use WSL with Visual Studio Code

Install VS Code and then the Remote – WSL extension.

Steps:

  1. Open VS Code
  2. Click the Extensions icon
  3. Search and install Remote – WSL
  4. Open a folder inside WSL using the command palette: Ctrl + Shift + P → “Remote-WSL: New Window”

This lets you run your code inside the Linux environment while editing with Windows tools.

Bonus: Export and Import WSL Distributions

You can export a WSL instance to back it up or transfer it.

Export:

powershell

CopyEdit

wsl –export Ubuntu ubuntu_backup.tar

Import:

powershell

CopyEdit

wsl –import UbuntuNew D:\WSL\UbuntuNew ubuntu_backup.tar

This is useful for creating consistent environments across multiple machines.

Troubleshooting Common WSL Issues

  • Virtualization not enabled: Check BIOS settings and enable Intel VT-x or AMD-V
  • WSL version not updating: Use wsl –set-version <distro name> 2
  • Permission errors: Run terminal as Administrator
  • Microsoft Store not installing distro: Download manually from command line using wsl –install -d <distro>

Conclusion

Running Linux on Windows using WSL gives you the best of both worlds—access to powerful Linux tools without leaving your familiar Windows setup. Whether you’re coding, testing, or learning Linux, WSL makes it accessible and efficient.

From my experience, WSL has become an essential part of my daily development environment. It’s easy to set up, fast to use, and integrates beautifully with Windows apps and tools.

With just a few commands, you can install a full Linux distro and begin using bash, Python, Git, and more—all without rebooting or switching systems.

Leave a Comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.