WSL, the Windows Subsystem for Linux, runs a Linux distribution such as Ubuntu inside Windows. You get Bash, apt and the rest of the Linux toolchain without giving up the Windows apps you rely on, and without rebooting into another operating system.
Why developers want Linux on Windows
Much of the software developers use day to day was built for Linux first. Servers in the cloud mostly run it, so deploy scripts, Dockerfiles and CI pipelines assume a Linux shell. Many tutorials say 'open a terminal and run sudo apt install', and plenty of open-source tools ship Linux builds before anything else.
On plain Windows those instructions don't work as written. PowerShell is a capable shell, but it isn't Bash: the commands, the paths and the package manager are all different. A script written for Linux usually needs rewriting before it runs. That gap is what WSL closes.
The old ways, and what they cost
Before WSL, a Windows user who wanted Linux had three choices, and each had a catch.
- Dual-booting installs Linux beside Windows, and you pick one at start-up. You get native speed, but you have to restart to switch, and partitioning the disk and setting up the bootloader is where things go wrong. A bad step can leave a machine that won't start.
- Switching to Linux full time removes the friction for development, but some Windows-only apps, a favourite video editor for example, have no Linux version.
- A traditional virtual machine (VirtualBox, VMware) runs Linux in a window. It's safe, but you have to set it up yourself, give it a fixed share of memory and disk, and copy files in and out. It boots slowly and feels like a separate computer.
WSL keeps Windows as the main system and adds Linux on demand, with none of that setup.
How WSL works
There are two versions, and the difference explains a lot of WSL's behaviour.
WSL 1 didn't run a Linux kernel at all. It translated the system calls Linux programs make (open a file, start a process) into Windows equivalents. That worked for many tools, but not every call could be translated, so some software, Docker included, couldn't run.
WSL 2, the default for new installs, runs a real Linux kernel built by Microsoft. It sits inside a lightweight virtual machine that Windows manages for you behind the scenes. That's why the video can say 'no virtual machine': there is one, but you never create or configure it the way you would a VirtualBox VM. It starts in about a second, borrows memory as it needs it and hands memory back when processes free it.
Because the kernel is real, WSL 2 has full system call compatibility: Linux programs behave as they would on a Linux machine. Windows keeps the kernel updated for you, and WSL itself is open source, with its code on GitHub.
Installing it
On Windows 11, or Windows 10 version 2004 or later, open PowerShell as administrator and run one command:
wsl --installIt turns on the Windows features WSL needs and installs Ubuntu, the default distribution. Restart when it asks. The first time Ubuntu opens, it unpacks itself and asks you to create a Linux username and password. These are separate from your Windows login, and the password is the one sudo will ask for.
To pick a different distribution, list what's available and install by name:
wsl --list --online
wsl --install -d Debianwsl --list --verbose (or wsl -l -v) shows what you have installed and whether each runs on WSL 1 or WSL 2.
A first session
Once Ubuntu is open, you're in a normal Bash shell. A typical first session updates the package lists, installs a couple of tools and runs a small script:
sudo apt update
sudo apt install -y git python3
mkdir -p ~/code/hello && cd ~/code/hello
echo 'print("hello from Linux")' > hi.py
python3 hi.pyThe last line prints hello from Linux. Nothing here is specific to WSL. The same commands work on an Ubuntu server, so what you learn locally carries over to production.
How Windows and Linux share files
The two systems can see each other's files, and where your project lives makes a big difference to speed.
- From Linux, your Windows drives appear under
/mnt, soC:\Users\youis/mnt/c/Users/you. - From Windows, your Linux files appear in File Explorer under
\\wsl$. Runningexplorer.exe .in a Linux folder opens it there. - Commands cross over too:
code .opens the current Linux folder in VS Code on Windows, andwsl lsrun from PowerShell runslsin Linux.
Crossing that boundary is slow in WSL 2. A Linux tool reading thousands of small files on /mnt/c (an npm install, a git status on a big repository) can take many times longer than the same work on the Linux side. Microsoft's own advice is to keep project files on the same operating system as the tools that work on them. If you build with Linux tools, keep the project under your Linux home folder, ~, and open it from Windows editors through the WSL integration.
Common mistakes
- Working from
/mnt/c: it works, but it's the slow path described above. Clone repositories into~instead. - Windows line endings in Linux scripts: Windows editors and Git on Windows can save files with CRLF line endings. Bash then reads the hidden carriage return as part of the command, and a script fails with errors such as
bad interpreter. Set your editor to LF for scripts, and check Git'score.autocrlfsetting. - Mixing Windows and Linux toolchains: running Windows
nodeagainst a project whose dependencies were installed by Linuxnpm(or the other way round) causes confusing failures. Pick one side per project and install the tools there. - Expecting a full desktop: WSL is built around the command line and development tools. Recent versions can run some Linux GUI apps in their own windows, but it isn't a replacement for a Linux desktop.
When WSL isn't the right fit
WSL is a development environment, not a server. If you need Linux to drive hardware directly, work on the kernel itself, or run software that needs a serial port, a real Linux machine or a dual-boot setup is still the better choice. If your whole workflow is Linux and you don't need any Windows apps, installing Linux outright removes a layer. For everyone who lives in Windows but builds for Linux, WSL is the simplest route.
Key takeaways
- WSL runs a Linux distribution, Ubuntu by default, alongside your Windows apps.
- WSL 2 runs a Linux kernel, not a translation layer, in a lightweight VM that Windows manages for you.
wsl --installin an administrator PowerShell sets everything up; restart, then create your Linux user.- Keep projects in your Linux home folder, not under
/mnt/c, for speed. - Watch for CRLF line endings and mixed Windows and Linux toolchains.