# Windows Subsystem for Linux (WSL): What It Is, Installation and Setup

URL: https://skillaria.top/en/guides/linux/wsl-windows-subsystem-for-linux

Windows Subsystem for Linux (WSL) is a feature of Windows 10 and 11 that runs a real Linux distribution without a separate virtual machine or dual boot. It is installed with the single command wsl --install in PowerShell run as administrator; by default it sets up WSL 2 with Ubuntu, where a genuine Linux kernel runs inside a lightweight virtual machine.

Windows Subsystem for Linux (WSL) is a component of Windows 10 and 11 that lets you run a Linux distribution directly inside Windows: a bash terminal, `apt`, `ssh`, `grep`, Docker and any command-line tool. You do not need VirtualBox or a split disk for a second system: Ubuntu opens as an ordinary terminal window in a few seconds. Below you will find how WSL 1 and WSL 2 differ, how to install the subsystem, how to work with files, VS Code and graphical applications, and what to do about common errors.

## What WSL is in Linux and Windows terms

In short, WSL gives you a full Linux environment for development and learning without leaving Windows. You install a distribution (Ubuntu, Debian, openSUSE, Kali, AlmaLinux and others) from the command line or the Microsoft Store, and then work in it just as you would on a server: users, permissions, packages and services.

It is important to understand what WSL does not do. It is not an emulator of commands like Cygwin, and it is not a set of ported utilities: WSL 2 runs a real Linux kernel built by Microsoft. That is why Linux binaries run without recompilation, and the skills you build in WSL transfer directly to a real server.

Typical uses of the subsystem:

- learning Linux and the command line without a separate computer;
- web development when production runs on Linux (Python, Node.js, PHP, Go);
- Docker Desktop, which uses WSL 2 as its engine;
- connecting to servers over SSH, writing bash scripts, and working with git in a familiar environment.

## WSL 1 and WSL 2: what the difference is

There are two architectures. WSL 1 translates Linux system calls into Windows kernel calls, so there is no real Linux kernel. WSL 2 runs a genuine Linux kernel inside a lightweight Hyper-V-based virtual machine, which starts in seconds and manages its own memory.

| Parameter | WSL 1 | WSL 2 |
| --- | --- | --- |

| Kernel | none, system calls are translated | real Linux kernel |

| System call compatibility | partial | full |

| Docker, systemd | no | yes |

| Speed on Linux files (`~/`) | lower | high |

| Speed on Windows files (`/mnt/c`) | high | noticeably lower |

| Requires virtualization | no | yes |

| Networking | shared with Windows | own virtual network (NAT by default) |

For almost all scenarios choose WSL 2, which is the default. WSL 1 makes sense if virtualization cannot be enabled (for example, Windows itself runs inside a virtual machine without nested virtualization) or if the project must stay on a Windows drive and is actively used there.

## How to install WSL on Windows 10 and 11

On Windows 11 and Windows 10 version 2004 or newer (build 19041+), installation comes down to one command. Open PowerShell or Windows Terminal as administrator and run:

```
wsl --install
```

The command enables the required Windows components, downloads the WSL 2 kernel and installs Ubuntu. After a restart, the distribution window opens: choose a Linux username and password. They are not linked to your Windows account; this password is needed for `sudo`.

```
Enter new UNIX username: alex
New password:
Retype new password:
passwd: password updated successfully
Installation successful!
```

Update the packages right away, as on any fresh server:

```
sudo apt update && sudo apt upgrade -y
```

### How to choose a distribution

Ubuntu is installed by default, but you can choose another distribution. To see what is available:

```
wsl --list --online
```

To install a specific distribution by its name from that list:

```
wsl --install -d Debian
```

If WSL is already installed, the command simply adds the new distribution. You can keep several systems at once, for example Ubuntu for work and Kali for experiments.

### Checking the version: wsl -l -v

To see the installed distributions, their state and the WSL version:

```
wsl -l -v
  NAME      STATE           VERSION
* Ubuntu    Running         2
  Debian    Stopped         2
```

The asterisk marks the default distribution, which starts when you run `wsl` without parameters. To change it, run `wsl --set-default Debian`.

### How to switch WSL 1 to WSL 2

The version used for new installations is set with:

```
wsl --set-default-version 2
```

An already installed distribution is converted separately (the data is kept, but the process can take several minutes):

```
wsl --set-version Ubuntu 2
```

To convert back, use `wsl --set-version Ubuntu 1`.

### Useful WSL management commands

| Command | What it does |
| --- | --- |

| `wsl` | open the default distribution |

| `wsl -d Debian` | open a specific distribution |

| `wsl --shutdown` | stop all distributions and the WSL 2 virtual machine |

| `wsl --terminate Ubuntu` | stop one distribution |

| `wsl --update` | update WSL and the kernel |

| `wsl --status` | default version and general status |

| `wsl --export Ubuntu ubuntu.tar` | back up a distribution to an archive |

| `wsl --import Ubuntu2 D:\wsl\u2 ubuntu.tar` | restore or clone a distribution |

| `wsl --unregister Ubuntu` | delete a distribution together with all its data |

Be careful with `--unregister`: files inside the distribution are deleted without going to the recycle bin. Run `--export` first.

## Moving files between Windows and Linux

Windows drives are mounted automatically inside WSL under `/mnt`: drive C: is `/mnt/c`, D: is `/mnt/d`.

```
cd /mnt/c/Users/alex/Downloads
ls -l
cp report.csv ~/projects/
```

In the other direction, Linux files are visible in File Explorer via the network path `\\wsl$\Ubuntu` (on Windows 11 also `\\wsl.localhost\Ubuntu`) and in the "Linux" section of the navigation pane. To open the current Linux directory in File Explorer quickly:

```
explorer.exe .
```

From WSL you can run Windows programs (`notepad.exe`, `code`), and from PowerShell you can run Linux commands with a prefix: `wsl ls -la`. To convert paths between the two systems, use the `wslpath` utility:

```
wslpath 'C:\Users\alex'
/mnt/c/Users/alex
```

The main performance rule for WSL 2: keep projects in the Linux filesystem (`~/projects`), not in `/mnt/c`. Access to Windows drives goes through a network protocol, and operations such as `git status` or `npm install` on a large project are many times slower there.

## VS Code and WSL

Visual Studio Code can work with WSL as with a remote machine: the interface stays in Windows, while the terminal, extensions, interpreters and debugger run inside Linux. You need the WSL extension (by Microsoft). Then, in the terminal of your distribution, go to the project directory and run:

```
cd ~/projects/site
code .
```

On first launch VS Code installs its server component in Linux by itself. An indicator "WSL: Ubuntu" appears in the lower-left corner, which means everything you run from the integrated terminal works in Linux. Extensions such as Python or ESLint should be installed "in WSL" — VS Code offers a button for this.

## Graphical applications in WSL (WSLg)

Windows 11 and current WSL versions on Windows 10 include WSLg, which supports graphical Linux applications out of the box, without setting up an X server. Install a program as usual, and its window will appear next to your Windows windows, with a shortcut in the Start menu.

```
sudo apt install gedit -y
gedit ~/.bashrc &
```

WSLg supports X11 and Wayland, sound and the clipboard. For everyday work with a full Linux desktop, however, it is not a replacement: WSL is designed for individual applications rather than for running GNOME or KDE as a whole.

## systemd and WSL 2 resources

Current versions of WSL 2 support systemd: in new Ubuntu installations it is enabled by default. If it is not, add the following to the `/etc/wsl.conf` file inside the distribution:

```
[boot]
systemd=true
```

and restart the subsystem from PowerShell with `wsl --shutdown`. After that, `systemctl` and services such as nginx or PostgreSQL work.

You can limit the memory and processors of the WSL 2 virtual machine in the `%UserProfile%\.wslconfig` file on the Windows side:

```
[wsl2]
memory=4GB
processors=2
```

The settings apply after `wsl --shutdown`.

## Common WSL installation errors

### Error 0x80370102

Full text: "The virtual machine could not be started because a required component is not installed" (WslRegisterDistribution failed with error: 0x80370102). The cause is almost always the same: WSL 2 cannot start its virtual machine. Check the following in order:

1. Is hardware virtualization enabled in the BIOS/UEFI: Intel VT-x (Intel Virtualization Technology) or AMD-V (SVM Mode)? The state is shown in Task Manager → Performance → CPU → "Virtualization: Enabled".
2. Is the "Virtual Machine Platform" component enabled?
3. Is the hypervisor disabled in the boot configuration?

The components are enabled from an administrator PowerShell:

```
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
bcdedit /set hypervisorlaunchtype auto
```

Then restart the computer. If you are working inside a virtual machine, nested virtualization must be allowed on the host — or use WSL 1.

### Other common problems

- **0x800701bc** — the WSL 2 kernel is out of date. Run `wsl --update`.
- **The `wsl --install` command only prints help** — WSL is already installed; add a distribution with `wsl --install -d Ubuntu`.
- **No internet inside WSL while a VPN is on** — the VPN client intercepts the routes of the virtual network. On Windows 11, the `networkingMode=mirrored` setting in the `[wsl2]` section of `.wslconfig` helps.
- **WSL takes up a lot of disk space** — the `ext4.vhdx` virtual disk grows, but does not shrink by itself after files are deleted. You can compact it manually or move the distribution with `--export`/`--import`.
- **Forgot the Linux password** — log in as root from PowerShell with `wsl -u root`, then run `passwd alex`.

## WSL, a virtual machine or dual boot

WSL is not the only way to get Linux on a Windows computer. The choice depends on the task.

| Option | Pros | Cons | When to choose |
| --- | --- | --- | --- |

| WSL 2 | starts in seconds, shared files, VS Code, Docker | no full desktop, quirks with networking and disks | development, learning the command line, scripts |

| Virtual machine (VirtualBox, Hyper-V, VMware) | full isolation, snapshots, any distribution and desktop, own network adapter | heavier, resources are allocated in advance | server lab, network and boot experiments, disk partitioning practice |

| Dual boot | full hardware power, native graphics and drivers | reboot to switch, risk when partitioning the disk | Linux as the main system, games and GPU tasks on Linux |

To learn Linux from scratch, WSL is usually enough: files, permissions, processes, packages, bash scripts and SSH work the same way as on a server. A virtual machine becomes necessary when you reach things that work differently in WSL: the bootloader, partitioning of physical disks, network interfaces and host-level firewalls.

## Summary

Windows Subsystem for Linux gives you a real Linux environment inside Windows with one command, `wsl --install`. Choose WSL 2, check versions with `wsl -l -v`, keep projects in `~/` rather than `/mnt/c`, and connect VS Code through the WSL extension. If installation fails with 0x80370102, enable virtualization in the BIOS and the "Virtual Machine Platform" component. Setting up this workspace is where practice in our Linux course begins.

## FAQ

**Is WSL free?**

Yes. WSL is included in all editions of Windows 10 and 11, including Home, and Linux distributions are also free to use.

**Can I run Docker in WSL?**

Yes, but only in WSL 2. You can install Docker Desktop with the WSL 2 engine, or install Docker Engine directly in the distribution, as on a regular Ubuntu server.

**Where are the files of a WSL distribution physically stored?**

In WSL 2 they are kept in an ext4.vhdx virtual disk inside the Windows user profile. You do not need to open it directly: use the \\wsl$\ path in File Explorer.

**How do I remove WSL completely?**

Delete the distributions with wsl --unregister , then uninstall the "Windows Subsystem for Linux" app in "Installed apps", and disable the Windows components if needed.

**Can I move WSL to another drive?**

Yes: wsl --export Ubuntu ubuntu.tar, then wsl --unregister Ubuntu and wsl --import Ubuntu D:\wsl\ubuntu ubuntu.tar. Newer versions also have wsl --manage Ubuntu --move.


---
Source: Skillaria.Top (https://skillaria.top)
