Scott Hanselman

Developers can run Bash Shell and user-mode Ubuntu Linux binaries on Windows 10

3月 30, '16 コメント [3] Posted in Open Source | Win10
Sponsored By

As a web developer who uses Windows 10, sometimes I'll end up browsing the web and stumble on some cool new open source command-line utility and see something like this:

A single lonely $

In that past, that $ prompt meant "not for me" as a Windows user.

I'd look for prompts like

C:\>

or

PS C:\>

Of course, I didn't always find the prompts that worked like I did. But today at BUILD in the Day One keynote Kevin Gallo announced that you can now run "Bash on Ubuntu on Windows." This is a new developer feature included in a Windows 10 "Anniversary" update (coming soon). It lets you run native user-mode Linux shells and command-line tools unchanged, on Windows.

After turning on Developer Mode in Windows Settings and adding the Feature, run you bash and are prompted to get Ubuntu on Windows from Canonical via the Windows Store, like this:

Installing Ubuntu on Windows

This isn't Bash or Ubuntu running in a VM. This is a real native Bash Linux binary running on Windows itself. It's fast and lightweight and it's the real binaries. This is an genuine Ubuntu image on top of Windows with all the Linux tools I use like awk, sed, grep, vi, etc. It's fast and it's lightweight. The binaries are downloaded by you - using apt-get - just as on Linux, because it is Linux. You can apt-get and download other tools like Ruby, Redis, emacs, and on and on. This is brilliant for developers that use a diverse set of tools like me.

This runs on 64-bit Windows and doesn't use virtual machines. Where does bash on Windows fit in to your life as a developer?

If you want to run Bash on Windows, you've historically had a few choices.

  • Cygwin - GNU command line utilities compiled for Win32 with great native Windows integration. But it's not Linux.
  • HyperV and Ubuntu - Run an entire Linux VM (dedicating x gigs of RAM, and x gigs of disk) and then remote into it (RDP, VNC, ssh)
    • Docker is also an option to run a Linux container, under a HyperV VM

Running bash on Windows hits in the sweet spot. It behaves like Linux because it executes real Linux binaries. Just hit the Windows Key and type bash.

After you're setup, run apt-get update and get a few developer packages. I wanted Redis and Emacs. I did an apt-get install emacs23 to get emacs. Note this is the actual emacs retrieved from Ubuntu's feed.

Running emacs on Windows

Of course, I have no idea how to CLOSE emacs, so I'll close the window. ;)

Note that this isn't about Linux Servers or Server workloads. This is a developer-focused release that removes a major barrier for developers who want or need to use Linux tools as part of their workflow. Here I got Redis via apt-get and now I can run it in standalone mode.

Running Redis Standalone on Windows

I'm using bash to run Redis while writing ASP.NET apps in Visual Studio that use the Redis cache. I can then later deploy to Azure using the Azure Redis Cache, so it's a very natural workflow for me.

Look how happy my Start Menu is now!

A happy start menu witih Ubuntu

Keep an eye out at http://blogs.msdn.microsoft.com/commandline for technical details in the coming weeks. There's also some great updates to the underlying console with better support for control codes, ANSI, VT100, and lots more. This is an early developer experience and the team will be collection feedback and comments. You'll find Ubuntu on Windows available to developers as a feature in a build Windows 10 coming soon. Expect some things to not work early on, but have fun exploring and seeing how bash on Ubuntu on Windows fits into your developer workflow!


Sponsor:  BUILD - it’s what being a developer is all about so do it the best you can. That’s why Stackify built Prefix. No .NET profiler is easier or more powerful. You’re 2 clicks and $0 away, so build on! prefix.io

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by ORCS Web
2016年3月30日 16:18:48 UTC
Love it...
chadbr
2016年3月30日 16:24:46 UTC
This makes me so incredibly happy, I can't even begin to explain it. Though, I'm curious, do you know if SSH will work here as well? That's honestly what I think I'd end up using the most.

Also FYI, the link: https://msdn.microsoft.com/commandline goes to a 404 page.
Preston Moore
2016年3月30日 16:27:40 UTC
What do you mean by it's not a VM, but a Linux image running in Windows? It sounds like a virtualized something.
Jon Taylor
名前
メールアドレス gravatarアイコンを表示)
ホームページ
 
コメント(一部のHTMLは使用可能です:a@href@title, b, blockquote@cite, em, i, li, ol, pre, strike, strong, sub, super, u, ul@はattributeつまり属性を意味します。例えば、<a href="" title=""> or <blockquote cite="Scott">.などを使用することができます。)
コメントのプレビューを同時に表示

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.