Windows Sub-System Linux – Why it’s a big thing

Most IT professionals (Like yours’ truly) never find Windows OS to be an attractive option for our work. It’s not once or twice when you find yourself in need for tools that are only available on other Operating Systems especially Linux OS. While the user interface is amazing, some tools of the tools we really hold dear are not designed for windows. Yes, there are some pots, hacks and even windows version of the same, but they never work as perfectly as in their native environment (Linux OS). It is not until Microsoft released Windows Sub-System Linux (WSL) during the release of Windows anniversary update.
To me, it came at very important time, I was seriously contemplating migrating away from windows. As a PHP developer on windows, you find that most of the time you are developing for Linux based server, which bring in some complication. For instance, the unlink function in PHP for deleting files does not work by default on windows. I spent a very long time than I care to admin, while trying to make it work and just when I had given up, I found out that it works on Linux, without much struggle, assuming you have the correct file permissions. To install PHP extensions on windows can be tricky sometimes. While the folks at WAMP Server and PHP have the most popular extensions there by default, some of the can be extremely difficult to find or have only Linux versions available. To simplify this, PHP development on Windows OS is only great if you are developing for windows but not Linux.
I found myself in a situation where I seriously considered migrating from Windows OS. I considered switching to Linux OS but I hate the user interface in various Linux distributions. And I wouldn’t get myself around to having two devices or even duo boot. I could have used a Virtual Machine but it would have slowed my PC significantly since most of the time I have so many things open at the same time. And that’s how I decided to test bash for ubuntu, which was still in beta, and is still is.
Windows subsystem Linux or Bash for Ubuntu allows you to run a stripped-down version of ubuntu on windows, with complete interoperability between windows and the Linux subsystem as explained here. While it has come a long way since then, originally it was good at doing some stuff but not all. It also had some serious flaws like: to run some bash commands such as networking or install some apps smoothly you had to run as administrator. I also could not edit the files directly using my windows text editor without risk of losing them. Other than that, I could install a web server based on Apache, MySQL and PHP without any problems. And to sweeten the deal, it run much more efficiently compared to my windows apache web server. The biggest hurdle I faced was how work on my project and then transfer them to local web server for testing. To work around this problem, I set up a dev folder on windows and since all files windows were accessible by bash via a mounted drive (/mnt/d/path/to/project), I could just copy to the www folder of the apache each time I wanted to test my code. And the best bit was, I could run this command right from command prompt or PowerShell. After some time, I stopped using the copy command, because it was taking so long to copy and overwrite all the files and began using the rsync utility to synchronize just the new files. I could find a way to automate the rsync command to sync the files on save or on interval much like grunt watch works, but I don’t find the need to. Now I could use my favorite text editor – Visual Studio Code – and test my application on almost similar environment to my production server.
Since I started using bash for windows, there is no single task I have thrown at it and it has been unable to undertake, yes sometimes it takes time to get something to work, but again, that’s to do more with me, than the system. I have even been able to run a Janus Graph Database using a local Cassandra – Elastic cache backend successfully (albeit with limited success – it used all my 8gb RAM) and even DynamoDB backend, this one was much more stable. Bash for windows is not meant for production servers, but for developers and it works as advertised. Giving windows OS the ability to run Linux utilities natively (or close) was a deal maker for me. It’s the main reason I am still using windows and why Windows sub-system Linux is such a big thing for both Microsoft and windows Developers.

One Reply to “Windows Sub-System Linux – Why it’s a big thing”

Leave a Reply

Your email address will not be published. Required fields are marked *

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