Better git and other Linux based command line tools on Windows 10

One fantastic new feature in the latest version of Windows 10 is an add on you can install that allows you to use an Ubuntu-based Linux distribution natively in Windows. This opens up a whole new world for developers on Windows, including access to the same class of Git and SSH tools that are available on OS X (goodbye PuTTY!).

To enable it, start by heading to Settings, Update & security, For developers and turn Developer mode on.

Then, right click on the Start icon, click Programs & Features, “Turn Windows features on or off” and enable “Windows Subsystem for Linux (beta)”. You’ll need to then restart your machine.

Once back, open a new admin command by right clicking Start and choosing “Command Prompt (Admin)”. Then type “bash” and hit enter. You’ll need to set some things up – including choosing a new username and password for the Linux install – then an Ubuntu image will download from the Windows Store. You’ll then be dumped into a bash prompt that will be familiar if you have used a Terminal on OS X.

The first thing you should do is run “sudo apt-get update”. This will update most components of the Ubuntu install.

Using the new Git

You can now use Ubuntu’s version of Git, instead of the Windows version you likely have installed. To install it, open a bash command and type “sudo apt-get install git”.

Opening a bash prompt in your Windows user directory by default

By default, the “Bash on Ubuntu on Windows” shortcut opens a bash prompt in the user directory of the Ubuntu install. This isn’t very useful if you still need to interoperate with files in your main user directory. To fix this, start by right clicking on the “Bash on Ubuntu on Windows” shortcut in the Start menu, going to More and Open file location.

You can then right click on the shortcut and choose Properties. Delete the tilde ~ character from the end of “Target”, enter %USERPROFILE% in the “Start in” box and hit OK.

Clicking the shortcut will now open in your Windows user profile folder via the magic of the mount points set up.

Simply right click the icon in the taskbar and pin it to get a shiny new Unix-based command line on Windows without Cygwin or MINGW32. Magic!


Shameless plug: This post was written with Net Writer – a little app I wrote to help blogging on Windows 10. If you have Windows 10, download it for free.

One Response to “Better git and other Linux based command line tools on Windows 10”

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>