Windows Subsystem for Linux (WSL)

I mention this a lot, but it’s no secret that the Windows command-line experience has been lackluster for the past decade or two. It’s quite apparent that Microsoft is well-aware of this, and we’ve seen improvements with Microsoft Powershell (CMD prompt is straight doo-doo 💩) but it isn’t perfect.

I’m going to sound like a Microsoft fan-boy, but they’ve been seriously impressing me lately. The VSCode editor is best-in-show (seriously, who isn’t using it as their code editor in 2019) and everything appears to be moving to a more open source environment. What I appreciate most here from Windows is that, instead of try and re-create their entire OS structure to match a UNIX based system, they simply…. give you the UNIX based system.

Enter WSL

Windows Subsystem for Linux (WSL) is a compatibility layer for running Linux binary executables natively on Windows 10 and Windows Server 2019. In lay terms, you can pull up a lightweight, fully functional Linux terminal right in your desktop without running a virtual machine. Yes, really.

1 Technically it’s a lightweight VM but it feels so different.

Why is this important?

While more and more software developed is cross-platform, the actual development of most non-Windows software (think .Net, C#/++) is done in UNIX environments (Linux/MacOS). Don’t believe me? Check out the Stack Overflow Developer Surveys for the past two years (2019 and 2018) – more than half are using a Linux-based system or MacOS.

But that’s just a survey. In practice, even some of our products at Automattic don’t compile on Windows. Calypso, for example, The JavaScript and API powered platform will not compile in a Windows environment… at least, I’m not aware of anyone that has a working dev environment in Windows, Automattician or open-source contributor alike.

Beyond that, with a working Linux environment that feels natural, we can grab all of our favorite software packages and set up environments with common UNIX-like commands without having to head to stack overflow (or this site 😁) every time we want to set an alias.

So how do you get started?

Craig Loewen over at Microsoft has put together some really excellent guides to getting started over at the official docs in the Microsoft Devblogs, and it really feels like I’d be doing him (and you) a disservice by not pointing you there. Here are some of my favorites:

In general though, head to the Microsoft store on your Windows machine and search “Linux”. There’s just about every distro in there, from Debian to Kali. I prefer Ubuntu, so that’s what I use.

One that’s downloaded, simply launch the Terminal and you’re good to go.

⚠ At the time of this article, you can’t directly modify files in WSL from Windows Explorer. [Edit: Craig mentions you can actually modify your Linux files directly from the File Explorer in Windows Version 1903 and Higher!] 🎉

Modification of Linux files through Explorer

So how do you interact/program with Software packages?

If you have WSL open, all you need to do is open VSCode on your windows machine and it will prompt you to install the Remote – WSL extension.

Then, simply type code . in your Linux terminal like you normally would, and it’ll launch your directory in VSCode…. Magic!

It’s not perfect

Yet. I’m hoping to see improvements as Microsoft gets closer and closer to releasing the new Windows Terminal (have you seen that commercial? huge kudos to Kayla & her team over at Microsoft 🔥) but at the time of this article I’m not able to set up a Docker container on it, and a few other caveats as well. For the most part though, I’m loving the path Microsoft is on and will continue to cheer them on as they do great things.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.