Microsoft loves Linux

Running Bash on Ubuntu on Windows

Microsoft Loves Linux!

I Love History

In the beginning was the command line. Actually, before the command line was the punch card, but that’s prehistoric. So let me give you some history; Early computers were massive. It’s hard for us to understand just how big and expensive these first computers were, considering that you have more computing power on the phone in your pocket than was used to put the first man on the moon. But these mainframe computers would fill entire buildings, and anyone who wanted to actually use the computer had to treat it like a timeshare and wait their turn. An early—and largely unsuccessful—attempt to create an operating system that would allow multiple users to login simultaneously was called MULTICS. In 1969, an offshoot of this project was led by Ken Thompson and Dennis Ritchie at AT&T Bell Labs, and it was called UNIX (as a play on words). This, plus the subsequent invention of the C programming language by those same geniuses, really started the modern computing revolution. Mere mortals could now gain access to a computer and learn how to code their own programs without needing to learn cryptic machine assembly language commands.

The downside to UNIX, however, was that it was technically proprietary software, owned in part by AT&T, and much of the underlying code was developed by the University of California at Berkley, and so it had to be licensed to be used. On October 5, 1991, a Finnish gentleman by the name of Linus Torvalds recreated a UNIX-compliant operating system, rewriting it from the ground up, but essentially fulfilling all the same roles using the same commands. He called this new operating system “Linux”, and in a major twist, he released it—source code and all—free of charge to anyone who wanted it. This was a major turning point in the FOSS (Free and Open Source Software) community. Soon Linux began to grow as more and more enthusiasts added their efforts to make it a better operating system, all while remaining completely free of charge.

Even though today less than 2% of all desktop computers run Linux as the primary operating system, it’s actually the most widely distributed OS in the world, largely because most of the world’s internet servers run a variant of Linux, many internet-connected devices (like set-top media streaming devices and wireless routers) run an embedded Linux OS, and all Android phones and Chromebooks are running Linux. What Linux lacks in market share, though, it makes up for in power. Even though a Graphical User Interface (GUI) exists in Linux, most of its power lies in the command line, and the ability to administer a Linux machine remotely and securely using very little bandwidth. If you can master the command line in Linux, it will open up a whole new world of computing to you!

So until now, there have really only been three major players in the world of personal computers; Microsoft, with their ubiquitous Windows operating systems, dominate the PC market; Apple, which in 2001 switched to UNIX based operating system, come in a distant second in terms of market share; and lastly there is Linux, which has simply been too unfriendly to the average user to ever take off, in spite of its amazing price of $0.00. During the week of February 20, 2016, Microsoft made an unprecedented announcement; in partnership with Canonical (the company behind the popular Ubuntu Linux flavor), you can now run the bash command line terminal right from within Windows. This annoucement is a game changer.
 

What is Bash?

So what is bash? Bash is an acronym for the Bourne Again Shell—another play on words, as it was the successor to the Bourne shell. And bash is simply the command line interface for Linux. This is where you type in commands and the computer responds. A word of warning, though: If you’ve used a mouse your whole life, getting used to the command line has a bit of a learning curve. You have to type in everything you want the computer to do (no clicking!) and you can’t make any typos, either.
 

Installing the Bash Shell on Window 10

In a future release of Windows 10 (hopefully the anniversary edition due summer ’16) the bash shell will be included as a standard feature. For now, you have to have the latest version of the Fast Ring Windows 10 Technical Preview (build #14316) to install the bash terminal. It’s free to sign up for the technical previews of Windows 10, but I have to warn you, it’s not for the faint of heart, and is designed for early adopters to find bugs and report them, so it’s never a good idea to run it on your primary computer. 
  1. Go to the Settings App > Updates & Security > For Developers and make sure “Developer Mode” is selected
  2. Go to the Control Panel > Turn windows features on or off and scroll down and check the box next to “Windows Subsystem for Linux (beta)”
    windows features settings
  3. After clicking “OK” your PC will reboot
  4. Open a up the Windows Command Line ([Windows Key]  + [x] then [c])
  5. Type “Bash” and hit [Enter]
  6. Once you agree to Canonical’s EULA by pressing [y], the installer will download Bash
  7. Now you can launch the Bash on Ubuntu on Windows app from the Start Menu
  8. Have fun!

 

A Word of Warning

As the setting in Control Panel states, this is Beta software running on a developer preview of an OS. Expect problems and be prepared to give feedback! For instance, if you try to run the top command (to show active processes) in bash in windows you’ll get a blank screen. This can be remedied by re-launching bash or simply typing “reset” and hitting [Enter]. In fact, as far as I can tell, even the simple ifconfig command (to show networking information) doesn’t work. And if you’re looking to install a Linux GUI on top of bash, like gnome or KDE, you’re probably out of luck. There are some proof-of-concept methods for getting the X11 windows server up and running, but its usefulness seems limited. Maybe the most glaring omission in bash on Windows right now is the lack of sudo. I’ll talk more about this in my next articles, but for now just know that if you want to run commands as root, you’ll have to launch the bash app as administrator.

command window
In my next few articles I’ll get into the specifics of running Bash on Windows. I’ll show you how to “grok” the Linux way of thinking, and I’ll show you practical usage for bash.

This is a new Microsoft. Not just because Linux is going to exist on several million more computers worldwide this summer, but because Microsoft is committed to contributing to the Open Source community as a whole. In fact, it’s now possible to get a Microsoft MCSA certification in Linux, and there are even Microsoft Open Source MVPs now. On top of that, over 60% of all Azure usage (Microsoft’s industry-standard cloud computing platform) is used by virtualized Linux computers.

I’ll leave you with one last command to try out. From the bash command line, type the following and hit [Enter]:
apt-get install cowsay; clear; /usr/games/cowsay “Bit-Wizards rules!”

 
Comments
 
comments powered by Disqus

Author

Samuel O. Blowes, Director of IT
Samuel O. Blowes

Director of IT

Read more