ubuntu bash now in windows 10…?

There’s a little-known feature now in Windows 10 which is a fairly awesome piece if you know Linux/Ubuntu and, say, you’re a coder. Microsoft and Canonical got together to add an Ubuntu on Windows subsystem in the 14393.0 “Anniversary Update” OS Build.

The feature is also called the Windows Subsystem for Linux. What’s interesting is that from bash you can actually invoke a Windows executable or one compiled for Ubuntu. It can run DOS batch files as well as shell scripts.

  1. Turn on Developer Mode in Windows 10 -> Settings -> Update & Security -> For developers
  2. Turn on the Windows Subsystem for Linux (Beta) in Windows 10 -> search for “Turn Windows features” -> select Turn Windows features on or off
  3. Restart Windows 10
  4. Go to a command prompt
  5. Enter bash and type a y to continue, noting that this step will take about 20 minutes
  6. When finally prompted, enter a UNIX username (it’s case-sensitive) and a password (again, case-sensitive) which are completely separate from your other credentials

From this point you can run an Ubuntu bash prompt either from the added Start entry or by entering bash in an MS-DOS or PowerShell prompt.

Notes

  • It’s probably not a good idea to use Notepad or similar Windows tools to edit configuration files within the Ubuntu space.
  • You should be able to sudo from this first user as you might expect.
  • Once logged in, you’ll land in a /mnt/c/Users/username location from a Unix perspective.
  • Since the OS is Ubuntu, you would run sudo apt-get update to install things.
  • If you want to invoke Windows executables from a bash session, you probably want to start by adding the SYSTEM32 folder to your path, for example: export PATH=$PATH:/mnt/c/Windows/System32 but since this is UNIX you’ll need to make sure that the capitalization is right for each path.
  • Run lsb_release -a if you’d like to see which release of Ubuntu is running.
  • In theory, you could run bash scripts within a PowerShell script.
  • At this time, it does not support GUI applications.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s