The origins of WSL (Windows Subsystem for Linux) lies in Microsoft’s Project Astoria, a tool originally designed to port Android apps to Windows 10 Mobile. The project was killed in 2016 but the code formed the basis of WSL, which was released in beta later in the same year. Unlike third-party apps like Cygwin, WSL’s initial aim was native Linux compatibility through serving Unix programs as custom isolated ‘pico processes’.
In May 2019, Microsoft announced the release of WSL2, a huge improvement over its predecessor, given it uses virtualisation to run Linux kernels inside a lightweight virtual machine. This not only improves performance but adds full system call compatibility.
Both WSL2 and compatible Linux distros can easily be installed via the command line or Microsoft Store.
WSL’s ‘so what?’ moment
While WSL2 is certainly a much more efficient way of implementing Linux in Windows, it still needs to pass the ‘so what?’ test. In other words, why shouldn’t Linux developers and other interested parties just keep on running full distros of Linux in a dedicated virtual machine using software like VMWare or VirtualBox? The fact, for instance, that WSL2 now has GPU support and can even run GUI Linux apps is hardly enough reason to switch, as most VM software can do the same. As far as developers are concerned though, there’s every reason to take WSL2 for a spin. Not only is the setup incredibly simple but you can easily create and switch between distros with just a few keystrokes.
WSL2 can be installed via cmd.exe or the Microsoft Store. You can also use the store to install more Linux distros.
Files can be stored in isolated Linux filesystems, and updates can be carried out automatically across every installed distro. Command-line tools such as Bash, Vim and so on are supported out of the box and you can install more via the distro’s own package manager.
Crucially, using WSL2 gives you the ability to invoke Windows applications via the shell. Installed Linux apps are also listed in the Windows Start Menu, so can easily be launched there or via the command line.