Running Linux in Windows

I wrote this post about two weeks ago and apparently forgot to publish it… so publishing it now as a prefix to another post that will explain my new windows-based linux setup (what a weird sentence that is!)

It’s been said before, but what a weird time we live in!

As mentioned previously, I finally had to ditch MacOS as my main work OS, thanks to new machines just not matching the price and functionality (and reliability) point for me. And haven’t been a fan of the changes they’ve been making to MacOS over the years anyways…

So, I’m on day three of my (resumed) Windows journey. But, I’m a web developer primarily in the LAMP stack, and I know that I can’t just set up a dev environment within windows for that, when everything I create is hosted on Linux…

My original plan was to just set up a virtual machine in Windows and just work within that. But, thankfully I remembered that there’s now WSL (Windows Subsystem for Linux) that could be an option… and so far, so good!

WSL lets you run linux within Windows, without the need for a virtual machine, or Docker or whatever. Basically, one it’s set up – you can have a bash prompt – and once you have that, you can install all sorts of things you need to do your job efficiently.

I’m not going to go through the whole process because there’s plenty of good guides out there – I’ve linked to a few at the bottom of this post. Instead, I’ll focus on a couple of the gotchas that held me up as I was getting everything set up.

File Permissions
Once I got the LAMP stack up and running, I grabbed all my files off my old macbook and set them up on the new laptop. But, the first I ran git status it told me every file had changed. Great, that’s not a good sign! My first thought was the old issue with newlines – but that’s not an issue using WSL since you’re inside linux anyways… Turns out there’s some file permission weirdness, and all of my files now had 777– and git thought I wanted to change all those files’ permissions – probably not a good plan! Turns out setting a simple git config option to ignore permission changes took care of that problem:
git config core.filemode false

Getting a Decent Terminal
You can use the built-in windows terminal… and it certainly is leaps and bounds better than last time I used Windows (*cough* Vista) so there’s that. I should probably explore it more.

I tried a few other terminals recommended in one of the guides, w/mediocre results. Some felt slow. And many of them had problems recognizing the arrow keys in vim – I can get by without them but I tend to alternate between the arrow keys and other options when moving around in vim without much though, so having the arrow keys suddenly not working was jarring.

For awhile I was using the Hyper terminal because it looked good and handled arrow keys just fine – but it felt a little slow and had the occasional weird glitch. I guess it’s built with javascript/css, etc which is kind of cool. But, contrary to popular belief we do not have to use javascript (of all things) for everything under the sun…

So, I followed this guide to set up the linux xfce terminal, running via X. I was a little leery at first, flashbacks to my early linux days with X (think pre 2000) but of course things have gotten much easier since then! I’ve gotten it all set up and about to embark on a work session with the new setup – we’ll see!

Resources

https://docs.microsoft.com/en-us/windows/wsl/install-win10
https://cepa.io/2018/02/10/linuxizing-your-windows-pc-part1/
https://www.codza.com/blog/lamp-in-wsl-win10