Scott Hanselman

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

March 30, '16 Comments [118] Posted in Open Source | Win10
Sponsored By

UPDATE: I've recorded a 30 min video with developers from the project as well as Dustin from Ubuntu about HOW this works if you want more technical details.

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

Docker for Windows Beta announced

March 26, '16 Comments [23] Posted in VS2015
Sponsored By

Docker Desktop AppI'm continuing to learn about Docker and how it works in a developer's workflow (and Devops, and Production, etc as you move downstream). This week Docker released a beta of their new Docker for Mac and Docker for Windows. They've included OS native apps that run in the background (the "tray") that make Docker easier to use and set up. Previously I needed to disable Hyper-V and use VirtualBox, but this new Docker app automates Hyper-V automatically which more easily fits into my workflow, especially if I'm using other Hyper-V features, like the free Visual Studio Android Emulator.

I signed up at http://beta.docker.com. Once installed, when you run the Docker app with Hyper-V enabled Docker automatically creates the Linux "mobylinux" VM you need in Hyper-V, sets it up and starts it up.

"Moby" the Docker VM running in Hyper-V

After Docker for Windows (Beta) is installed, you just run PowerShell or CMD and type "docker" and it's already set up with the right PATH and Environment Variables and just works. It gets setup on your local machine as http://docker but the networking goes through Hyper -V, as it should.

The best part is that Docker for Windows supports "volume mounting" which means the container can see your code on your local device (they have a "wormhole" between the container and the host) which means you can do a "edit and refresh" type scenarios for development. In fact, Docker Tools for Visual Studio uses this feature - there's more details on this "Edit and Refresh "support in Visual Studio here.

The Docker Tools for Visual Studio can be downloaded at http://aka.ms/dockertoolsforvs. It adds a lot of nice integration like this:

Docker in VS

This makes the combination of Docker for Windows + Docker Tools for Visual Studio pretty sweet. As far as the VS Tools for Docker go, support for Windows is coming soon, but for now, here's what Version 0.10 of these tools support with a Linux container:

  • Docker assets for Debug and Release configurations are added to the project
  • A PowerShell script added to the project to coordinate the build and compose of containers, enabling you to extend them while keeping the Visual Studio designer experiences
  • F5 in Debug config, launches the PowerShell script to build and run your docker-compose.debug.yml file, with Volume Mapping configured
  • F5 in Release config launches the PowerShell script to build and run your docker-compose.release.yml file, with an image you can verify and push to your docker registry for deployment to other environment

You can read more about how Docker on Windows works at Steve Lasker's Blog and also watch his video about Visual Studio's support for Docker in his video on Ch9 and again, sign up for Docker Beta at http://beta.docker.com.


Sponsor: Thanks to Seq for sponsoring the feed this week! Need to make sense of complex or distributed apps? Structured logging helps your team cut through that complexity and resolve issues faster. Learn more about structured logging with Serilog and Seq at https://getseq.net.

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

How to set up a Raspberry Pi 3 from scratch (with video)!

March 23, '16 Comments [17] Posted in Hardware | Open Source
Sponsored By

My messy electronics workspaceMarchIsForMakers continues! It's my month-long collaboration with Saron from CodeNewbie. We've had some amazing guests on our respective podcasts and some great technical content. Please do check it out at http://marchisformakers.com and subscribe to my podcast Hanselminutes as well as the CodeNewbie podcast.

Here's a few of the things we've made for you lately:

Just last week I received my Raspberry Pi 3 in the mail. I called Saron and we decided not only to do an unboxing video, but an "unboxing, setup, AND make it do something" video.

Could we setup a Raspberry Pi 3 from scratch and get it to blink an LED in less than an hour?

Every STEM house should have a Raspberry Pi or six! We've got 4? Or 5? They end up living inside robots, or taped to the garage door, or running SCUMMVM Game Emulators, or powering DIY GameBoys.

If you have a Raspberry Pi 3, awesome. If not, this should work with an original Pi or a Pi 3. You'll want to make sure you have a few parts ready to save you time and trips to the store! I recommend a complete Raspberry Pi Kit when you're just getting started as it guarantees you'll be up and running in minutes. They include the mini SD Card (acts as a hard drive), a power supply, a case, etc. All you need to provide is a USB Keyboard and Mouse. I ended up getting a cheap Mini USB wired keyboardand cheap USB wired mouse for simplicity.

I like to use the new NOOBS setup direct from Raspberry Pi: https://www.raspberrypi.org/help/noobs-setup/. You can get SD cards with NOOBS preinstalled are available from many of our distributors and independent retailers, such as Pimoroni, Adafruit and Pi Hut if you like, but I had a blank card laying around.

I downloaded SD Formatter 4.0 for either Windows or Mac and prepped/formatted my card. Then I downloaded NOOBS and unzipped it directly into the root of my now-empty SD Card.

You plug the SD card into the Raspberry Pi and pick Raspbian as your Operating System (although there are other choices this is easiest for beginners) and wait a bit. The default login is "pi" and the password is "raspberry."

In this video we not only set it up, but we also got VNC working using RealVNC for Raspberry Pi, then Blinked an LED using Python. It was a blast, and was a little touch and go for a moment near the end as we had to pull out the multimeter to debug!

I hope you enjoy it. Also, be sure to explore the #MarchIsForMakers hashtag on Twitter to see lots of other fun stuff folks are doing during our month-long celebration.

What have you made this month?


Sponsor: Thanks to Seq for sponsoring the feed this week! Need to make sense of complex or distributed apps? Structured logging helps your team cut through that complexity and resolve issues faster. Learn more about structured logging with Serilog and Seq at https://getseq.net.

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

Building Visual Studio Code on a Raspberry Pi 3

March 15, '16 Comments [35] Posted in Hardware | Open Source
Sponsored By

Visual Studio Code running on a Raspberry Pi 3 - Michonne Approves

I picked up a Raspberry Pi 3 recently for MarchIsForMakers. The Raspberry Pi 3 is a great starter computer for makers not just because it is faster than the Pi and Pi 2, but because it has Wifi built in! This makes setup and messing around a lot easier.

Here's some great tutorials for getting started with the Raspberry Pi, Node, and Visual Studio Code.

I also recommend folks setup a VNC Server for their Raspberry Pi so you can TightVNC (meaning, remote in and control) into the Pi from your PC. You can also setup your Raspberry Pi to share the clipboard so you can copy from Windows and Paste into the VNC window when you are remoted into your Pi.

But why not build Visual Studio Code and get it running natively on the Pi? Marc Gravell did it first on Twitter, but I wanted to figure out how he did it and if it was still possible (he did it before some significant refactoring) and also to see if VS Code was faster (or even usable) on a Rasberry Pi 3.

Compiling Visual Studio Code on a Raspberry Pi 3

From the VS Code GitHub, you need Node, npm, and Python. The Pi has Python but it has an old node, so needed a newer node that ran on ARM processors.

get http://node-arm.herokuapp.com/node_latest_armhf.deb
sudo dpkg -i node_latest_armhf.deb

There are some NPM native modules like node-native-keymap that didn't work when I built the first time, so you'll need some supporting libraries first:

sudo apt-get install libx11-dev

Then, from my Raspberry Pi, I did this to build my own instance of VS Code.

git clone https://github.com/microsoft/vscode
cd vscode
./scripts/npm.sh install --arch=armhf

This took the Raspberry Pi 3 about 20 minutes so be patient.

Then, run your instance with ./scripts/code.sh from that same folder.

Note: Electron and Chromium underneath it use some very specific features of X Servers like "xrandr" for dynamic resizing and you may have trouble getting Visual Studio Code to run under a remote VNC session. Consider using RealVNC or TigerVNC for your Raspberry Pi, rather than the older TightVNC. RealVNC is a commercial product but they'll give you a free license for your Raspberry Pi.

Once you've updated to a newer VNC you can run VS Code

image

Check out MarchIsForMakers all month long as we partner with CodeNewbies and play and learn with maker hardware! Last week we unboxed my Raspberry Pi 3, set it up, and got it to blink an LED!

What have YOU done with your Raspberry Pi? Sound off in the comments.


Sponsor: Big thanks to Redgate for sponsoring the feed this week! Feeling the pain of managing & deploying database changes by hand? New Redgate ReadyRoll creates numerically ordered SQL migration scripts to take your schema from one version to the next. Try it free!

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

Finding the Perfect Mouse

March 9, '16 Comments [109] Posted in Hardware | Reviews
Sponsored By

I have a small problem. I'm always looking for great computer mice. I've tried a number of mice (and keyboards!) over the years.

Five black computer mice, laid out left to right, and described in order below

Here's the current line up.

But the left one...oh this mouse. That's the Logitech MX Master Wireless Mouse and it's really top of the line and it's my current daily driver. It's usually $99 but I've seen it for $74 or less on sale.

The Logitech MX Master is a high end mouse, but rather than catering to gamers as so many mice do, it seems to be aimed more towards creators and makers. Prosumers, if you will.

Highlights

  • The MX Master has rechargeable LiPo batteries that are charged with a simple micro USB cable. So far they've lasted me two weeks or more with just a few minutes of charging. Plus, you can use the mouse with the cord attached. There's a 3 light LED on the side as well as software support so you won't be surprised by a low battery.
  • Fantastic customizable software.
    Exceptional Logitech Mosue Customization Software
  • Uses the "Unifying Receiver" which means a single dongle for multiple Logitech products. I also have the Logitech T650 Touchpad and they share the same dongle.
  • Even better, the MX Master also supports Bluetooth so you can use either. This means I can take the mouse on the road and leave the dongle.
  • Tracks on glass. My actual desktop is in entirely glass. It's a big sheet of glass and I've always had to put mouse pads on it, even with Microsoft Mice. This mouse tracks the same on a pad or a glass surface.
  • Heavy but the right kind of heavy. It's about 5 oz and it has heft that says quality but not heft that's tiring to push around.

One of the most unusual features is the Scroll Wheel. Some mice of a smooth scroll wheel with no "texture" as you scroll. Others have very clear click, click, click as you scroll. The MX Master has both. That means you can use "Ratchet" mode (heh) or "Freespin" mode, and you can assign a Mode Shift. If I click the wheel you can hear a clear mechanical click as (presumably) a magnet locks into place to provide the ratcheting sound and feel which is great for precision. Click again and you are FLYING through long PDFs or Web Pages. It's really amazing and not like any mouse I've used in this respect.

On top of that there is a SmartShift feature that automatically switches you between modes depending on the speed and vigor that you spin the wheel. All of this is configurable, to be clear.

It's a nice mouse for advanced folks or Devs because not only can you change basically every button (including a unique "gesture button" at your thumb where you click it and move the mouse for things like 'Next Virtual Desktop') but you can also have...

image

...configurations on a per-application basis!

image

This is fantastic because I want Chrome to scroll and feel one way and Visual Studio to scroll and feel another.

It's been 6 weeks with this new mouse and it's now my daily driver for code, blog posts, Office, and everything.

Trying out this new @Logitech MX Master mouse. This thing is SO SMOOTH.

A photo posted by Scott Hanselman (@shanselman) on

 

What's your favorite mouse or pointing device? Let's hear it in the comments!


PSA: Be sure to check out http://MarchIsForMakers.com all month long for great hardware podcasts, blogs, and videos! Spread the word and tweet with #MarchIsForMakers!

* Referral links help me buy mice. Click them for me please.

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

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