Let’s look a WSL, the Windows Subsystem for Linux. It allows you to run Linux on Windows. It even integrates tightly with Windows. You’ll discover that it’s truly awesome. In fact, it’s the reason many developers are embracing Microsoft Windows again!
The new Microsoft?
Although I’ve been a big fan of Apple’s Macbook Air and Macbook Pro, I’ve recently made the switch to a Dell XPS laptop with Windows on it. I initially planned on wiping the Dell hard drive to install Linux on it, but since the beast has a 2 TB SSD disk, I changed my mind and decided to create a dual boot setup and keep Windows.
Now that I had Windows at my disposal again, I started experimenting with it. Although there have been cosmetic changes and improvements, there’s also a lot of stuff from the old days that seems pretty much unchanged. For example, there’s still that dreadful registry. Most shortcuts are unchanged, the look and feel are mostly the same, and the hardware support is still excellent.
However, what has changed is Microsoft’s attitude towards open-source software and the open-source ecosystem as a whole. Instead of seeing Linux as a threat, Microsoft has embraced it. And instead of reducing command-line usage to a minimum, Microsoft has seen the light and created both Powershell and Windows Terminal to help us developers get stuff done without a GUI.
Instead of seeing Linux as a threat, Microsoft has embraced it
Windows Subsystem for Linux
What really drew me back is WSL, short for Windows Subsystem for Linux. If you don’t know it yet, it’s the bomb!
Initially, WSL worked by translating Linux kernel calls to Windows calls. With WSL2, however, you’re running a real Linux kernel through a very thin virtualization layer. In fact, even Windows is running through that same hypervisor. So Linux becomes a first-class citizen on your system, sharing system resources with Windows.
Without going into all the details, I’ll just tell you the result: you can open a full-blown Linux terminal in seconds. Several distributions are available, like Ubuntu, Debian, Kali, and OpenSuse, all of them downloadable from the Microsoft store.
You can open a full-blown Linux terminal in seconds
Thanks to WSL, you no longer need a separate Linux partition, a bulky VM, or a second PC. You can run multiple Linux distributions right on your Windows desktop. And the best news is that it integrates very well with Windows and Visual Studio Code! For example, you can:
- Access your Linux files from Windows, e.g.
- Access your Windows files from Linux, e.g.
- Copy-paste text between Linux and Windows
- Connect VSCode, running under Windows, to the Linux environment
Visual Studio Code
Visual Studio Code is a free IDE from Microsoft, available on all the major platforms. I’ve been using IntelliJ IDEA for years, so I haven’t felt the need to use something else. Sure — I heard about VSCode and tried it too. It’s more than OK; I just settled on something else.
But now I have a good reason to switch: VSCode has excellent integration with WSL. You can enter something like this:
$ vscode my-project-dir/
and VSCode will:
- start a server on Linux,
- open VSCode on Windows in a regular window,
- connect to the server inside the WSL Linux environment.
You’re running VSCode natively on Windows, but you’re working in a Linux environment! If you open a terminal inside VSCode, it will be a Linux shell running in WSL. If you hit run, your software will compile and run on Linux. It’s seamless!
Docker Desktop and Kubernetes
Another interesting development is the way Docker Desktop integrates into WSL2.
Because Windows now has a full-fledged Linux environment, Docker can run its containers inside Linux. This has great performance benefits:
- It takes 10 seconds, instead of 1 minute, to start the Docker daemon
- It’s better able to manage CPU and memory usage
Another big advantage is that you can start Docker containers from both Windows and Linux. They will end up running in the same Docker daemon. In fact, you don’t even need to install Docker inside your Linux installation since Docker Desktop takes care of it, making sure the integration is optimal.
Docker desktop, optionally, integrates Kubernetes into the installation as well. It can be enabled from the settings page, in which case a single-node cluster is started and accessible from both Windows and Linux.
The bottom line
Windows has many Linux-minded developers covered these days, offering us:
- A stable desktop, with good hardware support
- A Linux environment to work on all kinds of projects that will end up on cloud machines, Docker containers, etcetera
- A terrific and free IDE (Visual Studio Code) with extensions for basically anything you can think of
- Awesome Docker Desktop integration
WSL2 is young; many improvements are coming up, like GUI support and native Windows support for ext4 file systems. Meanwhile, the rest of the industry keeps a close eye on these developments, so who knows what cool things will pop up in the coming months!
I haven’t removed my Linux partition yet, though. There’s still stuff that I can’t do inside WSL2, especially the sort of development that requires a GUI.