Windows Subsystem for Linux (WSL) lets you run a full Linux environment—complete with your favorite command‑line tools—right inside Windows 11. Whether you’re a developer who needs a quick Bash shell, a student learning Linux, or just a tech enthusiast curious about the blend of Windows and open‑source, this guide walks you through the entire process from enabling the feature to fine‑tuning your distro. By the end, you’ll have a working Linux terminal, be able to install packages, and know how to avoid the most common pitfalls.
What You’ll Need
- A Windows 11 PC (Version 22000 or later). Most modern builds include WSL support out of the box.
- An internet connection for downloading the Linux distribution and optional updates.
- Administrative rights on the machine (you’ll need to run a few commands as an administrator).
- Optional: A Microsoft account if you plan to use the Microsoft Store to install a distro.
Step 1: Enable the WSL Feature
WSL is a Windows optional component, which means it’s turned off by default on some installations. The easiest way to enable it is via PowerShell:
Open PowerShell as Administrator and run:
wsl --install
The --install flag does three things in one go: it enables the VirtualMachinePlatform and Microsoft-Windows-Subsystem-Linux optional features, sets WSL 2 as the default version, and downloads the latest Ubuntu LTS from the Microsoft Store. If you prefer a manual approach, you can enable the features separately:
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
After running either method, restart your computer to let Windows apply the changes.
Step 2: Set WSL 2 as the Default Version
WSL 2 offers a real Linux kernel, dramatically better file‑system performance, and full system‑call compatibility. To make sure every new distro you install uses WSL 2, run:
wsl --set-default-version 2 If you receive an error about the virtualization platform, double‑check that your BIOS/UEFI has “Virtualization Technology” (VT‑x/AMD‑V) enabled.
Step 3: Choose and Install a Linux Distribution
Windows 11 ships with the Microsoft Store pre‑installed, which is the most straightforward way to grab a distro. Open the Store, search for “Linux”, and you’ll see popular options like Ubuntu, Debian, Kali, and openSUSE. Click “Get” to download and install. For this guide we’ll stick with Ubuntu 22.04 LTS, but the steps are identical for any distro.
If you prefer a command‑line approach, you can pull a distro directly from the command prompt:
wsl --list --online # Shows all available distros
wsl --install -d Debian # Installs Debian instead of the default Ubuntu After the download finishes, launch the distro from the Start menu. The first launch will ask you to create a UNIX username and password—pick something memorable; this account is separate from your Windows credentials.
Step 4: Update Your Linux Environment
Just like any fresh Linux install, you should update the package lists and upgrade existing packages. In the newly opened terminal, run:
sudo apt update && sudo apt upgrade -y This ensures you have the latest security patches and software versions. If you’re using a non‑Debian distro, replace apt with the appropriate package manager (dnf, zypper, etc.).
Step 5: Configure Interoperability Between Windows and Linux
One of WSL’s biggest strengths is seamless file sharing. By default, your Windows drives are mounted under /mnt (e.g., /mnt/c for the C: drive). You can access your Windows files directly from Linux and vice‑versa. To make the experience smoother, you might want to add a few settings to /etc/wsl.conf:
[automount]
enabled = true
root = /mnt/
options = "metadata,umask=22,fmask=111"
[network]
generateResolvConf = false
Save the file, then restart WSL with:
wsl --shutdown
wsl The metadata option preserves Linux file permissions, and disabling automatic resolv.conf generation lets you set custom DNS servers if needed.
Step 6: Install Development Tools (Optional but Recommended)
Now that you have a working Linux shell, you can install the tools you actually need. For a typical web‑development stack, you might run:
# Git, curl, and build essentials
sudo apt install -y git curl build-essential
# Node.js (via nvm)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
source ~/.bashrc
nvm install --lts
# Python and pip
sudo apt install -y python3 python3-pip
Feel free to swap these for other languages or frameworks—WSL supports virtually anything you can run on a native Linux machine.
Common Mistakes to Avoid
Even beginners can trip over a few recurring issues:
- Skipping the reboot. After enabling the optional features, Windows won’t apply them until you restart.
- Using WSL 1 unintentionally. If you forget the
--set-default-version 2command, new distros default to the older WSL 1 engine, which lacks full system‑call support. - Running Linux commands with Windows paths. Mixing
C:Users...with Linux commands can cause “file not found” errors. Always use the/mnt/c/…format inside WSL. - Overlooking virtualization settings. Some laptops ship with VT‑x disabled for security. Enabling it in BIOS/UEFI is mandatory for WSL 2.
- Installing multiple distros without managing versions. Each distro can run a different WSL version. Use
wsl -l -vto view andwsl --set-version 2to correct mismatches.
Tips and Tricks
Here are a few shortcuts that make daily use of WSL feel native:
- Access Windows apps from Linux. Type
explorer.exe .inside a WSL directory to open the Windows File Explorer at that location. - Launch Linux tools from Windows. Press
Win + R, typewsl -e bash -c "htop"to runhtopwithout opening a full terminal. - Customize the default user. Edit
/etc/wsl.confwith[user]so you skip the login prompt.
default=yourusername - Use VS Code Remote‑WSL. Install the Remote – WSL extension, then open a folder inside WSL directly from VS Code for a seamless development experience.
- Back up your distro. Run
wsl --export backup.tarand laterwsl --import backup.tarto move or restore your environment.
Frequently Asked Questions
Can I run graphical Linux apps on WSL?
Yes! Windows 11 includes WSLg (WSL GUI) out of the box. After installing a distro, simply run sudo apt install -y gedit (or any GUI app) and launch it. The window will appear like any native Windows program.
Do I need a Microsoft Store account to install a distro?
No. While the Store provides a convenient UI, you can install any supported distro via the wsl --install -d command or by importing a custom rootfs tarball.
How much disk space does WSL use?
By default, each distro resides in a virtual hard‑disk (VHD) file under %USERPROFILE%AppDataLocalPackages. You can check its size with wsl --list --verbose and shrink it using optimize-vhd if needed.
Conclusion
Installing and configuring Windows Subsystem for Linux on Windows 11 is a straightforward process that opens the door to a full Linux ecosystem without leaving the comfort of your familiar Windows desktop. By following the steps above—enabling the feature, setting WSL 2 as default, picking a distro, updating it, and tweaking interoperability—you’ll have a robust development environment ready for anything from simple scripting to complex container workflows. Remember the common mistakes, leverage the tips, and you’ll spend less time troubleshooting and more time building. Happy coding!





