How to install Ubuntu Bash shell on Windows

You can now have your cake and eat it too.

The enterprise landscape is changing with the rise of Linux and open source, both have emerged as a dominant player in this segment. Even Microsoft admits that a Linux runs on more than 25 percent of machines on its Azure platform. Customers running Linux need native Linux tools to manage their machines. Windows doesn't have those capabilities. Microsoft has been working on PowerShell, but it has its own limitations. Developers running Windows machines can use virtual machines, but they have over 15-20 percent overload. There are solutions like Cygwin, but they are not ideal.

Microsoft came up with an interesting solution: bring Linux to Windows. Microsoft worked with Canonical to bring Ubuntu on Windows, which I have written about in detail.

I don’t have a dedicated Windows machine due to a lack of 'UNIX' capabilities on Windows. However, I do run Windows 10 in a virtual machine (VM) on Mac OS just for the sake of keeping myself updated with all three platforms – Linux, Mac OS and Windows.

So I tasked myself with running Bash shell on Windows. 

The first step is to become a Windows insider. Type ‘Advanced Windows Update option’ in the Windows 10 search bar and join the Insider build program. That gives you early access to upcoming and under development features of Windows. You will have to log into your Microsoft account in order to join the program. If you don’t have a Microsoft account, create one.

While you are still on the Advanced Windows Update option page, you will see the option to choose what kind of pre-release updates you want; choose the ‘Fast’ channel that will bring the latest packages quickly. Once you are in the Fast lane, you are all set. Check for updates from settings and install all updates.

It’s Windows, so restart your system.

Once restarted go to search option and type ‘Update & Security’. Go to ‘For Developers’ and choose the ‘Developer mode’ option. Now go back to Windows search bar and type ‘Turn Windows features on or off’ ad open it. And that’s when you will be dropped into the past, the old Windows XP era interface is still alive in Windows 10. On that setting page, scroll down and at the bottom you will find, ‘Windows Subsystem for Linux (Beta)’. Check the box. You are all set.

wsl Swapnil Bhartiya

Check the box for WSL (Windows subsystem for Linux)

Now all you need to do is install ‘Bash’ on Windows. Open the command prompt in Windows and type bash. It will start downloading Ubuntu for Windows. You are actually downloading Ubuntu on Windows. The only difference is that it will run on top of Windows kernel, instead of Linux kernel.

Since January of this year Canonical has been working closely with Microsoft to create a special version of Ubuntu user-land for Windows. It doesn’t include any X server or GUI component so what you get is complete command line Ubuntu on Windows. Once Ubuntu is installed, just type Bash or Ubuntu in the search box and it will open ‘Ubuntu’ terminal with Bash shell.

screen shot 2016 04 21 at 10.23.28 am Swapnil Bhartiya

Ubuntu Bash shell running in Windows 10.

Initially many users, including me, experienced problems with network connectivity. If you experience networking issues in Bash shell, open the resolve.conf file and add a line for your router IP.

nano /etc/resolv.conf

Here is an example, where is the IP address of my router:


Once done, close the file and check if you are connected. Now proceed with installing whatever command line tools that you need on your system.

Best of both worlds

The good thing is that you can now access Ubuntu and Windows file system from the Ubuntu command line. If you want to access Windows user directories such as documents and downloads, just cd /mnt/c/Users/user_name. You can cd to partitions and storage devices connected to your system. Awesome. Go ahead and use the great Linux tools and commands like cp, mv, rsync to manage your files on Windows system. Windows never had those capabilities. Isn’t that interesting?

The real advantage for developers is that now they have both Windows and Linux tools at their disposal and they can work on the same file from ‘Linux’ and Windows tools.

So if you are a Windows 10 user who runs a VM or dual boots with Ubuntu to use Linux tools, you don’t have to do that anymore. You can now run Ubuntu inside Windows.

I call it the best of both worlds.

This article is published as part of the IDG Contributor Network. Want to Join?

Copyright © 2016 IDG Communications, Inc.

Survey says! Share your insights in our 19th annual State of the CIO study