Windows Subsystem for Linux explained

Many developers have struggled to work on Windows systems with tools that either perform better on Linux or are not available on Windows at all. Solutions often involved installing a Linux distributive on a virtual machine, on a separate hard drive and configuring dual boot, or using tools like Cygwin. However, this is about to change as Microsoft introduced Windows Subsystem for Linux.

What is WSL?

screenshot of powershell and bash running in 2 windows
Bash running alongside Powershell

WSL (Windows Subsystem for Linux), is a compatibility layer for running Linux binaries in Windows environment. It was first introduced by Microsoft in Windows 1607 around 3 years ago. It is now included by default in Windows installations, you just have to manually turn it on.

Why do you even need it?

You may not be aware of it, but 93% of servers in the world are running on Linux. Linux systems are known to be very fast, reliable and secure. Software developers love Linux because of its infinite customization possibilities, performance, and specialized tools that are not available on other systems. Moreover, Android is based on Linux kernel and all of Apple’s systems (macOS, iOS, tvOS, watchOS) are unix-like.

What can WSL do?

Microsoft implemented a Linux-compatible kernel interface that allows you to run programs, initially developed for Linux. Right now you can choose one of the following Linux flavors: Ubuntu, OpenSUSE, Kali, Debian, Fedora, Pengwin and Alpine.

screenshot of microsoft store listing several linux images available for download
images are installable from Microsoft Store

It is important to note, that WSL does not contain any Linux kernel code. It just simulates its behavior so programs and environment can function. Otherwise, everything works as you expect: you can run commands, install packages (through apt-get, etc.), even use GUI applications. Keep in mind that to run GUI applications, you will need to install X Server for Windows, like XMing.

You can also use Docker inside WSL, though it will still require you to launch Docker for Windows and configure Docker in WSL to connect to it.

How do I use it?

Here is a step-by-step on how to install WSL on your computer:

  1. Open PowerShell as administrator and run

    Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

  2. Open Microsoft Store

    And install the distribution of your choice. If you are a beginner, Ubuntu is the way to go.

  3. Launch it from the Start menu

    After installing, it will come up as one of the programs in your start menu. When you launch it, a Linux command line will appear and you can start hacking away!


Earlier I noted that WSL does not contain any Linux kernel code. This has some drawbacks, including limited compatibility and reduced performance. However, Microsoft is about to release a second version of WSL, which works fundamentally different.

WSL 2 includes an authentic Linux kernel, slightly modified by Microsoft to ensure full compatibility. It uses virtualization technology and was designed to boost some resourceful operations (like apt-get, npm install, etc). Additionally, full kernel compatibility means you can run container platforms (such as Docker), natively.

How do I install it?

Some words of caution: WSL 2 is still in the beta stage and is not suitable for production usage. Also, it requires you to join the Windows Insider Program and get a beta version of Windows as well. If you choose to proceed, here is how to join this program.

Firstly, ensure you are running Windows Build 18917 or higher. You can check it by going Settings->System->About. Then, run the following commands in PowerShell as administrator:

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

You will need to restart your PC at this point. Then, install the desired Linux distribution from Microsoft store as outlined earlier. To make this distro use WSL 2, run this command in PowerShell as administrator:

wsl --set-version <Distro> 2

You need to replace <Distro> with the actual name of the distribution. You can see these names by running wsl -l. If you want to use WSL 2 by default for all new distributions, run

wsl --set-default-version 2

Finally, you can check which WSL version you are using by running wsl -l -v .

Now you know how to make use of the Linux ecosystem on Windows. I hope you found this article useful. Please let me know what you think in the comments!

Get new content delivered to your mailbox:

leave a comment