What is WSL? How to run Linux on Windows

Install the Windows Subsystem for Linux with one command and get a real Ubuntu terminal for practising server commands on your own PC.

5–8 minutes
Desk with a monitor showing code and small plants

The Windows Subsystem for Linux (WSL) lets you run a real Linux system, such as Ubuntu, inside Windows 10 or 11 without a second computer or dual booting. This guide is for anyone who looks after a website or server and wants a safe place on their own PC to learn and test Linux commands.

WSL is a Windows feature that runs Linux alongside Windows, with a full Linux terminal and its own files. To install it, open PowerShell as administrator, run **wsl --install, restart, then choose a Linux user name and password. You need Windows 10 version 2004 (build 19041) or later, or Windows 11, and it installs Ubuntu** by default.

What WSL actually is

Most web serversWeb server The program that answers visitors’ browsers and sends them your website. Also used for the computer it runs on. More about Web server → run Linux. If your own computer runs Windows, practising server work used to mean renting a server or setting up a virtual machine by hand. WSL removes that step.

There are two versions:

VersionHow it worksWhen you meet it
WSL 2Runs a real Linux kernel in a small, managed virtual machineThe default for new installs. Use this.
WSL 1Translates Linux system calls into Windows ones, with no real kernelOlder installs and a few special cases

With WSL 2 you get the same apt, systemctl and configuration files you would find on an Ubuntu server, so commands you learn here work the same way on a real one. The Linux system is called a distribution (or distro), and you can install more than one side by side.

What WSL is good for:

  • Learning Linux commands before you touch a live server.
  • Running ssh, rsync, dig and other server tools from a proper Linux shell.
  • Testing an NginxNginx A fast, popular program that sends web pages to visitors and can pass requests on to apps behind it. More about Nginx → or PHP configuration before you copy it to production.

What it is not for: hosting a public website. WSL is built for development on your own machine, it stops when Windows shuts down, and it is not reachable from the internet in its default setup.

How to install WSL

1. Check your Windows version

Press Windows key + R, type winver and press Enter. Windows 11 of any version is fine. On Windows 10 you need version 2004 or later (build 19041 or higher). If yours is older, run Windows Update first.

2. Run the install command

Right-click the Start button, choose Terminal (Admin) or Windows PowerShell (Admin), and run:

wsl --install

This turns on the Windows features WSL needs, downloads the Linux kernel and installs Ubuntu. When it finishes, restart your computer.

To install a different distribution instead, list what is available and name the one you want:

wsl --list --online
wsl --install -d Debian

3. Create your Linux user

After the restart, Ubuntu opens and finishes setting up. It asks for a user name and password. These belong to Linux only and have nothing to do with your Windows login. Pick a simple lowercase name such as exampleco.

The password is what sudo asks for when you run a command with administrator rights (the Linux equivalent of root access). Nothing appears on screen while you type it. That is normal.

4. Update the system

Just as on a new server, update the package lists and installed software first:

sudo apt update
sudo apt upgrade

5. Confirm it is WSL 2

Back in PowerShell, run:

wsl -l -v

You should see your distribution with 2 in the VERSION column. If it says 1, convert it:

wsl --set-version Ubuntu 2

Using WSL day to day

Opening it

Type wsl in any PowerShell window, or pick Ubuntu from the Start menu or from the drop-down in Windows Terminal. You land in your Linux home folder, /home/exampleco.

Moving between Windows and Linux files

The two systems can see each other’s files:

You are inTo reach the other side
LinuxYour C: drive is at /mnt/c, for example /mnt/c/Users/
WindowsType \\wsl.localhost\Ubuntu into File Explorer’s address bar
Linux, wanting a windowRun explorer.exe . to open the current Linux folder in File Explorer

Keep project files inside the Linux file system (under your home folder), not under /mnt/c. Working across the boundary is much slower, and Linux tools behave more predictably on their own file system.

Connecting to a real server

From the Ubuntu terminal you can log in to a server exactly as you would from a Linux machine:

ssh exampleco@203.0.113.10

SSHSSH A secure way to type commands on a server from your own computer, as if you were sitting at it. More about SSH → keys you create inside WSL live in ~/.ssh in Linux, separate from any keys in your Windows user folder.

Practising with a web server

Installing Nginx is a good first exercise because you can see the result in your Windows browser:

sudo apt install nginx
sudo systemctl start nginx

Then open http://localhost in Edge or Chrome on Windows. By default WSL 2 forwards localhost from Windows into Linux, so you should see the Nginx welcome page.

Turning on systemd

Servers use systemd to start and manage services, and systemctl depends on it. Recent Ubuntu installs in WSL usually have it switched on already. Check with:

ps -p 1 -o comm=

If the answer is systemd, you are set. If it says init, open the WSL configuration file:

sudo nano /etc/wsl.conf

Add these lines and save:

[boot]
systemd=true

Then restart WSL from PowerShell, so the change takes effect:

wsl --shutdown

Wait a few seconds and open Ubuntu again. /etc/wsl.conf holds settings for one distribution. Settings for WSL as a whole, such as memory limits and networking mode, go in a file called .wslconfig in your Windows user folder.

Useful WSL commands

Run these in PowerShell, not inside Linux:

CommandWhat it does
wsl -l -vLists installed distributions, whether each is running, and its WSL version
wsl --updateUpdates WSL and its Linux kernel
wsl --shutdownStops every running distribution, needed after configuration changes
wsl -d DebianOpens a specific distribution
wsl --set-default UbuntuChooses which distribution wsl opens by default
wsl --unregister DebianDeletes a distribution and all of its files, so copy anything you need first

Common problems

SymptomCauseFix
Error 0x80370102 during installHardware virtualisation is switched offTurn on Intel VT-x or AMD-V (sometimes called SVM) in your computer’s firmware settings, then try again
wsl is not recognisedWindows is too old or the install did not finishRun Windows Update, then run wsl --install again as administrator
“System has not been booted with systemd”systemd is not enabledAdd the [boot] section shown above, then run wsl --shutdown
http://localhost does not loadThe service is not running, or something on Windows already uses port 80Run sudo systemctl status nginx, then see ERR_CONNECTION_REFUSED
Commands are very slowYour files are under /mnt/cMove the project into your Linux home folder
Forgot the Linux passwordIt is separate from WindowsIn PowerShell run wsl -u root, then passwd exampleco to set a new one

WSL is a practice ground, not a backup. If you unregister a distribution or reset WSL, its files go with it. Keep anything important in Git or copied elsewhere.

Official documentation

Get the next guide

One email when there is something worth reading: new guides, errors going around, and hosting changes that affect your site.

No tracking pixels, and one click to leave.

Something out of date? Software changes. If a step no longer works, tell us and we will check it and update the page.