WSL (Windows Subsystem Linux): A Boon for Developers

In Guides by Bintoro Adi GunaLeave a Comment

wsl-illustration
Never thought I’d see the day.

Anda berbicara Bahasa Indonesia? Baca artikel terjemahannya di sini!

I’m a software developer. I code for a living. Also, I used to use Windows for my everyday tasks, and negligent to switch to Linux, despite what everyone says.

However, almost a year ago, I was issued a MacBook by my company, and a coding boot camp. From there, I learned that you can do your development faster from UNIX and its derivatives (Linux, macOS) compared to Windows. There are so many tools built into the Terminal and installing most development tools and libraries (such as Brew, ZSH) are also easier and faster. These tools aren’t available to Windows users, even though they are so efficient and time-saving. Even if there is, installing it may take more effort.

On the other hand, I cannot fully commit to Linux. I sometimes game and fully switching to Mac is expensive. So, what’s the solution for me?

Enter Windows Subsystem Linux, or WSL, for short, something that Microsoft officially supports in October 2018. It basically offers the capability of running UNIX shell inside Windows. I’ve given it a try and so far, it’s promising.

Installing WSL

Enable WSL in PowerShell

Installing WSL is pretty easy. All you need to do is to make sure you’ve installed Windows 10 October update, then go enable WSL in PowerShell using the following command. Oh, and make sure you execute it with admin rights.

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
Enabling the feature in PowerShell.

After you’re done, you’ll be prompted to restart your computer.

Installing Linux Distribution

When you’re done restarting, go ahead and search for Linux in Microsoft Store. You’ll be greeted with a banner like the image below. Click Get the apps button to view available Linux distributions.

Microsoft even prepared this banner for WSL.

Install the app normally.

Installing Ubuntu from Microsoft Store.

Using WSL

Initializing Distribution

Once your distro is done installing, you can either access it via the Start menu (your distribution name) or from the Command Prompt by launching wsl.exe.

Once installed, WSL is available in your Start menu.

The program will take you through the initialization process, in which you’ll create the default UNIX account needed for various purposes, one of which is running a command with sudo.

An account is needed to run commands which require root access.

Go Nuts

wsl-demonstration
On WSL, you can use your favorite UNIX commands.

As I said earlier, you can always access your Linux terminal via Start menu or wsl.exe. From there, you can use all your favorite UNIX commands such as ls, grep, or any other. You can also install tools and libraries that are only available on UNIX such as zsh and linuxBrew. There are some few caveats, though, as the Windows Subsystem Linux itself is still in development. Here are some that I know:

  1. It doesn’t have GUI (obviously…)
  2. The directory location is a bit different. Instead of using drive letter directly, you’ll have to go to /mnt/driveLetter to access your Windows drive.
  3. There may be incompatibilities between Windows and Linux version of the same software. For example, Linux Git has a strange issue of considering (almost) all files being changed, while in Windows version nothing was changed. Your mileage may vary.
  4. The WSL comes with bare package. Depending on your view, this may either be good or bad thing.

Conclusion

wsl-zsh-illustration
I never thought this would be possible on Windows.

Windows Subsystem Linux (or WSL) is the breakthrough we’ve been looking for, especially for software developers. I’ve always envied the Mac for having both UNIX and being pleasant to use, and always wished Windows to have the same capability. Now, we have it. Sure, it’s not perfect and still in active development, but at least it’s usable and I’ve already reaped some of its benefits. It seems like Microsoft has been hitting the right targets recently. Good job.

If you’re a software developer and uses Linux or Mac for your everyday job, and have a Windows computer lying around, I’d recommend you to give it a try. Who knows, you might like it.

Well, I guess that’s all for now, Folks. I hope this article is useful for you, and sorry for the long update, since I’m gearing up for holiday XD. Finally, as usual, thanks for visiting and see you in the next article. Happy long holidays, everyone! 😀

Taken from terra-novae.blogspot.com

Leave a Comment