Latest posts by Anil Erduran (see all)
- Manage Azure with Chef – Part 2: Generate a cookbook and recipe - Fri, Feb 17 2017
- Manage Azure with Chef – Part 1: Install Chef on Windows - Thu, Feb 16 2017
- Convert Group Policy to PowerShell DSC with ADMXtoDSC - Fri, Feb 3 2017
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:
Now you can add the Windows Subsystem for Linux feature using the “Turn Windows Feature on or off” menu:
After the restart, you are ready to go.
Simply open cmd or PowerShell and type “Bash.”
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.
The Ubuntu file system can be found here:
Now, let’s try some cool things.
You can simply SSH to any system without having Putty installed. It just works.
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.
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:
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:
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.
In my next post, I will give you have tips of what you can do with Windows 10 Bash.