Pages

Tuesday, March 31, 2020

Coding on Windows with Linux

Windows Subsystem for Linux is cool as cool can be. That is putting it mildly. I know not everyone will agree but bear with me. Hopefully my enthusiasm for this system is catching.

Code showing path
Code showing Linux path
I have separate laptops for Windows and Linux development. I spend more time in Windows than I care to admit. I haven’t needed to really merge the two before. But the need evolved in a subtle way.

GitHub has an interesting repository that I forked to use for myself. Chuck Groom’s One Page Bio “is an example one-pager site that prospective job-seekers can use to quickly highlight their accomplishments and make an introduction”. Very interesting example of an online bio. And I decided to use it.

Digging into the codebase I came across a few things I was not familiar with and some I had heard of but have no experience with. The long and short of it is I needed to familiarize myself with Jekyll and the fact that it is a Ruby Gem. Not part of my toolset so looking into installation there was an indication that there could be issues running on windows at times.

So why not use Linux? A quick look for Linux on Windows pulls up some options. And here is where the Windows Subsystem for Linux co mes into play. Another one of those things I had seen before but not tried. Used to have Linux installed in it’s own partition and I have used live CD/DVD versions before.

But the WSL looked like just the right thing. Easy install. And it is just as easy to remove. So why not?

Installed WSL. Started using it. Installing software just like any other Linux package. I even has a choice of Linux distributions so went with the old tried and true Ubuntu. It all worked like a charm.

Went ahead and installed Ruby and Jekyll. Then went through the whole 12-step Jekyll tutorial. Great little tutorial. Walks one through setting up a blog all the way to deployment. Easy to use, easy to learn, easy to understand. Can’t wait to try on a project of my own.

Which is interesting. I ended up using some of what I just learned going through the GitHub Learning Lab course on GitHub Pages Training. GitHub Pages uses Jekyll. Who would’ve thunk it?

So, back to the focus of this article. VS Code for an editor on Linux. I had heard it was available and I needed something more comprehensive than Nano. Upon looking for a version of Code for Ubuntu Linux I found references to using VS Code with the Windows Subsystem for Linux. Not quite what I wanted. Or was it?

The Windows Subsystem for Linux is a command line only system. No GUI available. Good enough for coding but not for a GUI based code editor. Which leaves out VS Code. At least for running directly on the Linux system.

But the WSL integrates well with the hosting Windows system. Drives are mounted such as the C hard drive which is available at /mnt/c. Easy enough to copy files to or from while using the Linux system.

Here comes the great part. With VS Code on your windows system, it will detect the WSL installation. So start up your VS Code app. And it should give you the option to install the Remote - WSL extension. If you don’t see this option, you may have to look for it.

Remote WSL extension

There is also an option for connecting with extensions for Python, SSH, and Containers. Would you like to see a step-by-step on installing the WSL and connecting to VS Code? Let me know with a comment.

Finally, I found this to be a very usable system. VS Code can be started from inside of your Linux system. And you are able to access the Windows file system and your Linux file system from within VS Code. Will be giving it a workout.

Links: