Setting up a reasonable and light-weight Linux-like (non-WSL) terminal environment on Windows

e · l · n
Nov 29, 2018

I was looking for was a no-fuss, lightweight, robust and as simple as possible solution to running my normal Bash-based workflow inside the main Windows filesystem, interacting with the Windows world. Turns out there are some solutions. Read on for more info on that.

Windows Subsystem for Linux too heavy

First, I must mention the impressive work by Microsoft on the Windows Subsystem for Linux (aka. WSL), which more or less lets you run an almost full-blown distribution of popular Linux distros like Ubuntu and Fedora. WSL is awesome, but also kind of heavy, easily taking something closer to an hour to install. It also has some odd behaviours like opening files in Windows from WSL will give you troubles with line endings (as you might know Windows uses \r\n for line endings while Linux uses just \n). Finally, the default bash terminal for WSL did not even have zoomable text. All in all, this made it clear that this is not the light-weight simple solution I was looking for. WSL is awesome, but too heavy that I will be comfortable to quickly install it on any Windows machine I need to spend time working on.

Enter Git-Bash and MSYS2

Thus, I continued my search. I found Git-Bash, which is part of the Git package for Windows. It provides a simple bash environment with git pre-installed and configured, and works extremely well for simple tasks.

The main drawback I found with Git-Bash was that it does not contain or allow an easy route to install my favorite terminal multiplexer / window manager: tmux. One nice blog post mentioned the system that Git-Bash builds upon, and that it sports a package manager which can install a lot more software: MSYS2. Long story short: I tried MSYS2, and now I'm (figuratively) in love. With a few (fixable) caveats I now can run pretty much my full command-line bash+tmux+vim+git(+etc etc) workflow from Xubuntu, IN WINDOWS, right inside the Windows filesystem ... and things just work!

So, for my own and others' documentation, I below provide documentation of the procedure I have so far followed to enable a comfortable very Linux-like bash environment in Windows.

How to set up a nice environment based on MSYS2

End result

If you follow the above instructions roughly, you might end up with an environment like this:

So far, I'm super pleased with this setup.

Some caveats

I noticed the following caveats:

Samuel