Microsoft Windows has a mixed reputation, but there is no denying that over the years it has taken over PCs and laptops around the world as a visually approachable, easy-to-use (at least on the surface) and very capable operating system. It is usually installed by default and used by most people, because it can run a wide range of programs. Let's be honest: not everyone is a developer or an administrator, Macs are quite expensive, and even professionals don't always want to use the "penguin". Still, sometimes (especially among more advanced users) you need tools that exist only on Unix-like systems. And that is where the problem begins.
Windows and Linux (the most popular family of Unix-like systems) are different. That is obvious and not worth mentioning (which didn't stop me from mentioning it). For many people, though, the differences don't matter that much, because they usually find so-called ports, meaning versions of individual programs built for a given operating system. Trouble starts when a port doesn't work as it should, isn't easy to configure or simply doesn't exist. In the world of video games this is common, since not every title is available on both consoles and personal computers, but gamers put up with it. Today, however, we will focus on the needs of developers, who find it harder to put up with it when client requirements dictate specific solutions.
And here, surprisingly, Microsoft itself offered a helping hand. This is unusual, because for many years the company was seen as not particularly open to working with Linux. But it has to be said that a lot has changed since then, and in several areas Microsoft has taken a quite decent path toward being friendly to the IT community. Before we look at the "invention" of the giant from Redmond, the WSL from the title, let's see how developers can cope when they have to run a program on a Unix-like system.
One note: in this article I won't go into technical details. I'll focus on the practical use of the tools I describe.
Existing ways to run Linux on Windows
Most of you probably just thought of a "virtual machine", and that is a very good lead, because it is usually how you deal with the situation when you need a Linux environment for a while but don't want to leave the comfort of Windows. Programs such as VirtualBox or VMware make it easy to set aside resources for a "subsystem" in which you can install and use any operating system you have an image for. On top of that, the two environments are clearly separated, which leaves room for all kinds of tests. You can also forward ports, so that services running on Linux are available on Windows, and even set up shared folders for exchanging files.
Since we have such a solution (which is widely used when setting up servers), why consider anything else? The main reason is the poor performance of such a setup and its noticeable "weight". Of course, it all depends on the machine and the resources assigned, but a virtual Linux simply won't run as smoothly or be as pleasant to use as a system installed the traditional way. In addition, virtualization programs aren't always comfortable and trouble-free, and more advanced operations call for knowledge that not everyone has or has time to acquire. So while it is a great way to quickly get a Linux for testing, it isn't without drawbacks.
Another solution is, of course, installing Linux as a second system and using it when needed. It is the native route and very fast, but the obvious downside is having to switch between systems and being able to use the resources of only one of them at a time. Often, though, it is the first step toward fully befriending the system with the penguin, and I know people who dropped Windows completely this way and moved entirely to Linux. Still, for quickly trying out Unix tools, this solution deserves the well-known verdict "the shortcomings are known".
Some things can be run with Cygwin, which provides some of the tools directly in Windows through a special console. To a degree we already use Cygwin (a stripped-down version) when we install Git on Windows, which also brings Git Bash. In many cases it is a very helpful and functional tool, although it is not quite the same as Cygwin.
Of course, another path is to invest in Apple hardware, where macOS combines the convenience of Windows with a Unix foundation, giving you two worlds in one and a solid everyday operating system. For most uses it is an excellent solution. Even people who maintain web systems for a living, the so-called DevOps engineers, sometimes admit they prefer a MacBook for its comfort and sufficient set of tools. But as we said, it is quite expensive and still not a full-fledged Linux.
Fortunately, there is one more way, and it is the hero of today's text.
Windows Subsystem for Linux
That is what WSL stands for, and it is literally a Windows subsystem for Linux. In short, you can describe it as one more program that lets you open a native Linux inside windows. It is safe (in most cases, of course), and the two systems connect naturally and share resources. For example, if you start a server on port X in Linux, you can reach it from Windows as well. For details of how WSL works and how it is built inside, see the official documentation, as well as Polish sources, such as this very good video from the Pasja Informatyki channel and the CupOfCodes.pl blog.
It is very important that there are two versions of the software, the first and the second. For most people "version 1" is enough, since it already lets you install Linux inside Windows. For "professional" use, though, version 2 is recommended. It is built differently (it contains an actual kernel, the Linux core), which makes it faster and, as many will find a breakthrough, lets you run Docker under Windows. For simply installing Linux in Windows, version 1 should be completely satisfactory.
It is worth mentioning that installing WSL requires at least Windows 10 build 19041. Most users already have such a version. The second version of the tool takes a bit more effort, since it requires a higher patch level and/or an additional update. Keep in mind that you can switch machines and selectively upgrade them to a given version.
How to install WSL
Installing this component is split into several steps that you can carry out graphically or from the console. As professionals we should take the second route and pretend the GUI doesn't exist, but let's be honest: the first is more comfortable for many users, and both lead to the same goal.
First, through the search screen or the Control Panel, find the option "Turn Windows features on or off" and select the following components to install:
- Virtual Machine Platform
- Windows Subsystem for Linux
Enabling these items requires restarting Windows. The next step is optional but makes work much easier: install Windows Terminal. It is a multi-terminal for Windows that supports PowerShell, plain CMD and also the consoles of the Linux distributions installed in our WSL. It can open them in tabs, which matters to people who often work in a console on a windowed system. With a small modification you can also get it to open the Git Bash mentioned earlier, so that in 99% of cases you only need a single window with many consoles of different types in tabs. It is very convenient, and although the program isn't perfect, it cuts down on switching between many windows.
How do you install Windows Terminal? Just use the Microsoft Store app available by default in Windows 10 and 11. Don't worry: you don't need to create an account or pay for anything. Type the app's name, open its page and install it with one button. As I wrote, this app is not a required part of installing WSL but rather a sizeable convenience worth looking into for many reasons.
Back to the main thread. Once WSL is installed after enabling the right components, you can bring in Linux. There are many distributions to choose from. The most popular choice is Ubuntu, though some people will look with slight distaste at the size of the download, especially if they want Linux for a simple task, such as running a server program. In that case it is worth looking at a minimal installation of Debian, to which you can always add packages later when needed, even a graphical user interface. There are more distributions, so it is worth browsing the store.
You install the chosen Linux the same way as any app from the Microsoft Store, then launch it from the Windows main menu. The first time, you set up the account details and... that's it. The system installed in WSL runs in the background, and you can switch to it at any time through the app on your computer or through the Windows Terminal mentioned earlier, which lets you open a terminal in that environment right away.
You can list the installed distributions with the console command wsl -l -v, which also shows their running status and the WSL version.
What can you use WSL for?
This platform provided by Windows gives a developer plenty of options, and there is no need to fiddle around testing Linux tools in an environment unfriendly to them. As a result, your toolkit and technology stack grow considerably at a relatively small cost.
The big advantage and most common reason to use WSL is Docker, the popular containerization tool and, with it, an established way of managing software components, at least during a project's implementation. Because this field is closely tied to the Linux kernel, Docker is available only on the second version of WSL, but the mere fact that you can run it on Windows is already a big plus.
Another target use is Redis, a simple but very fast key-value database that, used well, is a great help with caching (saving previously fetched values in memory and restoring them later to speed up an application), but has no Windows port. Its configuration and use are very simple, the results are very interesting, and testing it on Windows is possible and pleasant precisely after installing Linux under WSL.
People who want to play with penetration testing also have it easier thanks to the Kali Linux distribution and, with it, easier access to the tools it contains. True, this kind of work is done by cybersecurity specialists, who mostly treat the system with the penguin as their main one, but situations vary, and sometimes it is useful (or tempting) to check something as a "layperson" or simply on Windows.
Of course, these and other tools can be run in other ways too, for instance with a virtual machine. But as I said at the beginning, WSL beats a "virtual box" in ease of use, performance and integration with the main Windows system.
Summary
Developers, and people who like exploring different tools and experimenting with the components used to build applications, will sooner or later need to get to know Linux better, test something or use a particular Unix tool. With WSL this is very simple and comfortable and, above all, doesn't disrupt the workflow of someone whose home system is Microsoft Windows.
Best regards and thank you, Jakub Rojek.


