What is WSL (Windows Subsystem for Linux)?
Learn what WSL is, the difference between WSL 1 and WSL 2, how to install Linux on Windows without dual boot, and how to use WSL with VS Code and Docker.
Beginner$ wsl --install▍Want to learn Linux, but your computer runs Windows? In the past, your options were dual boot (installing both systems and picking one when the computer starts) or running a heavy virtual machine. Today there’s a much simpler path: WSL.
WSL (Windows Subsystem for Linux) is a Windows feature that lets you run a real Linux environment, with a terminal, commands, and programs, side by side with your Windows apps. No restarting, no disk partitioning. If Linux is still new to you, start with what is Linux.
WSL 1 vs. WSL 2
There are two versions. The difference is in how Linux talks to the hardware:
- WSL 1 works like a translator: it takes requests from Linux programs (the system calls) and translates them for Windows.
- WSL 2 runs a real Linux kernel inside a lightweight virtual machine that Windows manages automatically. The kernel is the core of the operating system, like a car’s engine; with the original engine, everything works the way it should.
| Aspect | WSL 1 | WSL 2 |
|---|---|---|
| How it works | Translation layer | Real Linux kernel in a lightweight VM |
| Compatibility with Linux programs | Partial | Full (or nearly) |
| Speed with files inside Linux | Slower | Much faster |
Speed with Windows files (/mnt/c) |
Faster | Slower |
| Docker support | No | Yes |
| Recommendation | Specific cases | Default for most people |
If you’re just getting started, the answer is simple: use WSL 2.
Requirements
- A recent version of Windows 10 or Windows 11, with updates installed.
- Virtualization enabled in the BIOS/UEFI (the computer’s low-level settings). On most modern machines it’s already on; you can check in Task Manager, Performance tab, CPU item, “Virtualization” field.
Installing step by step
Open PowerShell as administrator (right-click the Start menu and choose the Terminal or PowerShell option as administrator) and run:
# installs WSL and, by default, the Ubuntu distribution
wsl --install
Restart the computer when asked. The first time Ubuntu opens, it will ask you to create a Linux username and password. They are separate from your Windows account, and the password is used with sudo, the command that runs tasks as administrator.
Other useful commands, also in PowerShell:
# lists the distributions available to install
wsl --list --online
# installs a specific distribution (use a name from the list)
wsl --install -d Debian
# shows installed distributions and the WSL version of each
wsl -l -v
# makes sure new distributions use WSL 2
wsl --set-default-version 2
# shuts down all distributions (useful after changing settings)
wsl --shutdown
# updates WSL
wsl --update
A distribution (or distro) is a “flavor” of Linux put together by a project or company, such as Ubuntu, Debian, or openSUSE. Once installed, it shows up in the Start menu and also as a tab in Windows Terminal.
Accessing files both ways
The two systems can see each other’s files:
- From Windows to Linux: in File Explorer, type
\\wsl.localhost\Ubuntu(or\\wsl$\Ubuntu) in the address bar. - From Linux to Windows: your drives show up under
/mnt. TheC:drive is at/mnt/c.
# inside Ubuntu (WSL)
cd ~ # your home folder in Linux
ls /mnt/c/Users # Windows user folders
explorer.exe . # opens the current folder in Windows File Explorer
Important performance tip: keep your projects inside the Linux filesystem (for example, in ~/projects), not in /mnt/c. In WSL 2, reading and writing Windows files from Linux is much slower, and commands like git status or installing dependencies can take far longer.
Using VS Code with WSL
VS Code runs on Windows, but it can work “inside” Linux:
- Install VS Code on Windows.
- Install Microsoft’s WSL extension (formerly called “Remote - WSL”).
- In the Ubuntu terminal, go to your project folder and type
code ..
The editor opens on Windows, but the integrated terminal, extensions, and commands run on Linux. It’s the best of both worlds. While you’re there, set up Git by following what is Git and GitHub.
Docker and WSL 2
Docker Desktop for Windows can use WSL 2 as its foundation (the so-called WSL 2 backend). In Docker Desktop’s settings, you enable integration with your distro and can then run docker commands straight from the Ubuntu terminal. With that, you can even run a lightweight local Kubernetes on your laptop.
Limiting memory and CPU with .wslconfig
The WSL 2 virtual machine uses memory as needed and, on computers with little RAM, it can slow Windows down. To set limits, create a .wslconfig file in your Windows user folder (C:\Users\YourUser\.wslconfig):
[wsl2]
memory=4GB
processors=2
Then run wsl --shutdown in PowerShell and open Ubuntu again to apply it. These settings apply to every distro that uses WSL 2.
Try it yourself
- Check whether virtualization is enabled in Task Manager
- Install WSL with
wsl --installand create your Linux user - Run
wsl -l -vand confirm your distro uses version 2 - Create a
~/projectsfolder in Linux and open it in File Explorer withexplorer.exe . - Install the WSL extension in VS Code and open a project with
code . - Create a
.wslconfigwith a memory limit and apply it withwsl --shutdown
Next steps
With WSL, Windows is no longer an excuse: your Linux lab is just one command away.