In this post, I will show how to install Bash on Windows 10 and quickly go through some of my experiences with this new Windows feature.
Avatar
Follow me:
Latest posts by Anil Erduran (see all)

During the Build 2016 keynote, Microsoft made a big announcement: “The Bash shell is coming to Windows.” No one saw that coming. This feature means so much for developers because it allows them to run native Bash on Ubuntu on Windows 10.

It looks like Microsoft listened to feedback and has made it easier for everyone to use open source tools natively on Windows. We should not expect to see support for KDE or Gnome-like Linux desktop experiences, but it is intended for developers to make their lives easier while making the two ecosystems more integrated.

First things first, yes, it runs on Ubuntu. However, it is not an Ubuntu virtual machine or container running on top of Windows. You can think of it as an emulator that translates Linux calls into Windows OS calls. Native Ubuntu binaries are running directly in Windows Subsystem for Linux.

To start with Bash, you must have the latest Windows Insider (Build 14316). It is part of the fast ring of updates.

Next, you need to enable developer mode under Update and Security:

Enable Developer mode

Enable Developer mode

Now you can add the Windows Subsystem for Linux feature using the “Turn Windows Feature on or off” menu:

Turn on feature Windows subsystem on Linux

Turn on feature Windows subsystem on Linux

After the restart, you are ready to go.

Simply open cmd or PowerShell and type “Bash.”

Install Bash for the first time

Install Bash for the first time

On the first attempt, you will need to accept the terms, and Bash will be ready in a couple of seconds.

For those with previous experience with Ubuntu or Bash, you’re ready to go! Just start by using your favorite commands. In the beta version, most of the commands are available, such as ssh, apt, find, mysql, python, perl, md5sum, gpg, curl, wget, apache, mysql, python, perl, ruby, php, gcc, diff, and patch.

You can see that all default Windows drives are mounted under /mnt.

mnt mounting

mnt mounting

Listing Windows directories

Listing Windows directories

The Ubuntu file system can be found here:

Ubuntu file system

Ubuntu file system

Now, let’s try some cool things.

You can simply SSH to any system without having Putty installed. It just works.

Using SSH

Using SSH

I started my “scripting” career with PowerShell. Yes, I had some bad experiences with VBScript, but PowerShell was a milestone for me. Once I learned most of the concepts, such as statements, loops, variables, etc., I decided to jump over to Python as its syntax is also super easy and allows you to enable a bunch of different automation scenarios.

On my Windows 10 client, I usually install Python and then start to play with it. However, as far as I know, it should already be enabled on Ubuntu, so I just checked it.

Python installation

Python installation

Yes. Python 2 and 3 are already installed and embedded, so we can say that Windows 10 comes with Python installed by default.

That’s great as you can simply start developing with Python and install additional modules or packages. For instance, if you are interested in game development, you can install one of the popular modules, PYgame, using the following command in Windows:

Installing additional Python modules

Installing additional Python modules

One thing I realized with Bash is that DNS was not working properly. I’m not sure if it’s a bug or expected configuration, but you need to run the following command with your DNS Server IP address to fix this issue:

Fixing DNS issue

Fixing DNS issue

In conclusion, if you are a Windows Insider and want to check how Bash does in Windows 10, go ahead and try it out. Microsoft also continues to collect feedback regarding Bash support on Windows Command-line UserVoice portal.

Subscribe to 4sysops newsletter!

In my next post, I will give you have tips of what you can do with Windows 10 Bash.

0 Comments

Leave a reply

Your email address will not be published. Required fields are marked *

*

© 4sysops 2006 - 2023

CONTACT US

Please ask IT administration questions in the forums. Any other messages are welcome.

Sending

Log in with your credentials

or    

Forgot your details?

Create Account