Linux BASH Shell On Windows With 'Microsoft 2.0'


We have come a long way from the days Steve Balmer declared Linux 'a cancer', and the culture of 'fear uncertinty and doubt' was tightly ingrained across Microsoft. I recall baulking when I heard it the first time... what a guy.... :/


Thankfully things have moved far from that era, and we now have true visionaries at the wheel. I continue to be delighted daily by Microsoft 2.0, by their new embrace of openness and the seeming realisation that sharing and integrating floats everyone to the top, and thats a very good thing. My preferred operating system for work is Windows, but I am also a heavy Linux user. Generally I keep a Virtual Machine open for my Linux work or use a second or remote box. Recently however I decided to install the BASH command line tool onto all of my machines, and honestly, for most tasks, I rarely have to spin up a local virtual machine any more, I simply use the Windows Bash tool, and its highly recommended!  (but might not make Steve happy!!)



This short article forms part of the DevOps/Infrastructure focused series, building out a cloud agnostic virtual machine cluster on Azure using different technologies including Terraform, Kubernetes, and Docker. In the first article in this series, I introduced 'Terraform', and gave an introduction to what it is, and how to use it. The second article dicussed how to use variables, interpolation and resource count to make multiple copies of resources to save duplication of config/code. The third article covered using scripts to remotly install and update machines using Terraform scripts.

When buliding the foundation base virtual machines, we need to generate SSH keys, and also need to be abel to remote into our machines. It turns out that having 'Bash on windows' installed makes this process much easier. This article walks through the steps of setting things up.

Installing BASH on Windows 10

Step 1

The Bash utility was actually introduced in the Windows 10 anniversity edition, and the major pre-requisite for installing it is to ensure that your vesion of Windows 10 is up to date, and the 64 bit version.

Step 2

Get your machine into Developer mode state.

Go into> settings, updates and security, 'for developers', and ensure the 'developer mode' setting is turned on. If not, turn it on, accept the warning message, and reboot your machine  (do it now, I'll wait...).


Step 3

Next we need to go into the control panel > programs > turn windows features on/off...


In here, check the 'Linux subsystem for windows', and click OK to close the dialog.


The system will now go through a download/install procedure, and when finished, you will need to reboot the machine.

Step 4

Now the base system is installed, we need to install and configure BASH itself. Do this by opening your search prompt (windows key + s) and looking for 'bash.exe'. Run this program when located.


Step 5

when the program starts, you need to accept the base ubuntu license (the linux operating system), and let it install...


Step 6

after the installation process completes you will be asked for an admin username/password..


and finally, you now have the BASH prompt ready to use!


If you are not familiar with Linux, here are some quick commands to get you started,

Basic Linux commands
lsDirectory listing, same as DIR in windows
ls -alDirectory listing, but also shows any hidden files
pwdDisplay the current directory you are in
ssh user@hostUse the Secure Shell utility to connect to a remote machine. user' is remote user you are connecting as, 'host' is the IP or domain name of the remote machine
ssh - p port user@hostIf you need to remotely connect on a particular port, you can specify the port after the 'p' switch
exitlogs out of the BASH shell... you can also use CTRL + D
Arrow keys! ^VUse the arrow keys on your keyboard to scroll through your previously typed commands ... useful!

I also attach a very useful Linux command line CHEATSHEET that is also available on Fosswire. We will be using the BASH shell in the next part of the series that looks at setting up Kubernetes on Azure, so please do install it if you are following along.

Bye bye steve!

Finally, lets say goodbye to Steve who in 2007 famously declared... “There's no chance that the iPhone is going to get any significant market share. No chance.”

Hey Steve, I think you got it wrong !! 


Similar Articles