‘Bash’ on Windows
I’m about two weeks into using what Microsoft calls, in their infinite
marketing wisdom, ‘bash on Windows.’ We is simple folk around here, so
we assumed that when MSFT said ‘bash’ they meant a shell. Maybe a shell
that FOR THE LOVE OF GOD dealt with the correct slashes to separate
directories, and that would respond correctly to when I typed
Quite the contrary it turns out. I really have no idea how I missed all of this, but what is called Bash on Windows is really a full blown Ubuntu userspace running right on top of Windows. That is, if it’s in an Ubuntu repo or can be added to what’s in /etc/apt it can be installed. With a few exceptions, of course, but not nearly as many as one might expect.
The install process on my dirt-cheap-Asus-laptop-that-was-fished-out-of- a-lake-and-then-put-on-sale-so-I-could-afford-it was simple as could be. Go into the Windows control panel, enable ‘Developer mode’ and then find where you add and remove features and include ‘Windows Subsytem for Linux (beta)’ and wait a while. After a reboot open a command window and type ‘bash’ and after setting up a password you’re up and running.
What I expected, again, was just a shell command prompt and maybe the
ability to write bash scripts instead of powershell or batch files. In
fact, after setting up a superuser password one finds that there is a
pretty full blown Ubuntu install.
cd ~ to land you in, surprisingly, a
home directory, complete with a .bashrc and .bash_profile like a
reasonable person would expect.
I have a script I run on new Debian or Ubuntu VMs to install all of the goop I need to do the basics. Kernel headers, python headers, basic build tools, module-assistant and so on. On a lark I downloaded that same script and ran it and everything, I mean everything installed just as if I were on a proper linux box or VM. Somewhat surprised I cloned the VIM repo on github, ran my usual flags on the config script and installed VIM. This was a couple of weeks ago, again, and to my great surprise this was the first time I had installed version 8 of VIM anywhere.
I’m not a huge consumer of VIM plugins, but the eight or so that I have as my default all installed with literally no afford on my part. Cloned my dotfiles, ran Vundle and all was set. Actually, all was not set, I had to manually run helptags on the docs, but other than that everything was fine. Same for rbenv, tmux, terminal color schemes, and so forth.
In fact, the only quirks I ran into at first were Ubuntu specific things. For example, after install python-dev VIM still wasn’t compiling with python support. That turned out to be nothing more than that Ubuntu python has a different name for directory where the python dev files live.
not so bueno
All was not 100% of course. Docker wouldn’t work, and in fact I have yet to get a proper Go toolchain set up. Also Hugo (the static site generator I use for this stuff) was not reloading when files were changed in directories that were ostensibly being watched.
Having read a bit about this on the github section for Ubuntu Windows, I suspect these are related to less than perfect support in the faux kernel for file system events. I’ll write more about that as I know more.
One other thing that was odd is that I have not lived in a world with absolutely zero web browsing in a while. That has both ups and downs. One upside is that I spent more time cloning repos and installing from source, which is probably better anyway. One downside is that for things that need to visit a web page to get it, I wind up switching to Windows to download things.
fair play Microsoft
The best thing about using the Ubuntu environment is that it makes things easier to do. For years I’ve been jumping through hoops to get a good linux text editing and command line environment on the Windows machines I use so often at work. VMs, SSH sessions to remote devices, headless machines somewhere, RDP and so on. With, uh, Winbash? Bashindows? Whatever one calls it it’s a drop dead convenient way to work on Windows in a world that is (thanks be to Odin) increasingly owned by unix-like machines.
Thank you, thank you, thank you … …