Affiliate Disclosure: By buying the products we recommend, you help keep the site alive. Read more.
In March, 2016 Microsoft announced the awesome Canonical partnership. Touted as Linux on Windows, the developers rejoiced at the prospect of Bash coming to Windows. Rather than a virtual machine, the Windows 10 Anniversary Update promised to bring the full functionality of bash to Windows.
Bash for Windows has been live for some time, and packs a wallop of capabilities. While certainly catering to a developer audience, more features lurk beneath the command line. Learn more about Bash on Windows, from how and why you should install it, to hidden features you probably didn’t know about.
System Requirements for Bash on Windows
Getting Bash on Windows installed is pretty simple, but let’s start with the basics.
You’ll need a PC running Windows 10, a 64-bit PC, and the Windows 10 Anniversary Update installed. Since the update targeted developers, you’ll also need to toggle developer mode on. Rebooting may be required. Once it’s back on, Windows Subsystem for Linux (Beta) may be enabled under Windows Features. This then prompts another reboot, and finally once your system has turned back on, you can open Bash. Woohoo!
So installing and running Bash on Windows is surprisingly easy. As long as you’re armed with a 64-bit Windows 10 PC and have the Anniversary Update installed, it’s as simple as switching on a few features.
Enabling Bash on Windows
Enabling Bash on Windows isn’t as difficult as it sounds. Here’s how to go about with install.
First, enable Developer Mode. Navigate to Settings > Update & Security > For Developers and select the bubble by Developer Mode.
Next, hit Windows keys + Q and search for Turn Windows Features on or off.
Check OK and reboot. Once up and running again, open the Start Menu and search for Bash. Click on the Bash run command option.
You’ll be promoted to accept the terms of service, and after agreeing to those, Bash will download.
Once this is finished, you can finally run Bash! To do this, simply open the Start Menu and search for Ubuntu.
What You Can Actually Do
One of the biggest questions, what can you actually do with Bash on Windows? Standard GNU command line tools including…
…should work perfectly. Installing packages and updates using apt and apt-get functions great as well. Symlink and file system support comes via the Windows Subsystem for Linux (WSL) environment, and there’s some programming language support for the likes of Python, NodeJS, and Perl. While Bash on Windows is not intended for running graphical apps, it can be accomplished.
Luckily, you can’t edit/open/delete Windows apps or alter Windows system settings. This is a great failsafe, as we all know mistakes can happen when using the command line.
Installing Linux Software
On Linux, you can install apps via several methods. The command line is most commonly used. The apt-get downloads software packages from repositories, along with dependencies. It’s nifty, and would look like this (sans-brackets, and with the actual package name):
sudo apt-get install [packagename]
If we’re installing Git for instance, we’ll run:
sudo apt-get install git
Pretty simple. However, make sure to include
sudo as we need superuser permissions. Git, and other software may be installed from source as well.
Born to Run (Graphical Apps)
Bash on Windows does not support graphical Linux apps, or at least officially. However, community members found a method of doing so using the apparently rather versatile Windows Subsystem for Linux. Just because something isn’t made for one purpose doesn’t mean it can’t be used for that.
Case in point: installing Bash for Windows installs an entire Ubuntu user space image. Basically, you get everything (all the binaries) that is featured on a traditional Ubuntu install with a graphical user interface (GUI).
By including a complete Ubuntu user space, it’s therefore possible to run graphical Linux apps on Windows. The workaround calls for installing X Server, using apt-get to install a program, setting a display environment variable, and finally launching the application. Though not particularly difficult, it is a cumbersome process as display environment variables must be set each time you want to run a graphical app.
Furthermore, it’s an unsupported feature, so functionality is contingent on a bevy of factors. As any native Linux user knows, app installs often require dependencies and tweaks as is, so you can only imagine jerry-rigging Bash on Windows to run these.
Want to run Linux graphical applications? You’re probably better off using Cygwin, a VM on Windows to run a Linux distribution or just dual booting. Then again, there is the novelty of graphical Linux apps on Windows.
Installing Bash for Windows creates a full Ubuntu user space. You can easily access these files using the Windows File Explorer. However, you will have to know where to look, which requires first enabling Show hidden files, folders, and drives under File Explorer view options. Each Windows user account has its own Ubuntu user space, which can be found by navigating to the folder:
The account home folder resides at:
With the root folder of:
Accessing Windows system files in Bash is a bit different. The default in Bash is the Ubuntu root directory created within the Windows file system. But you may mount the Windows system drive. So to mount the C: drive, use the command:
For the D: drive this would be:
And so on. Since we’re using the command line, we can couple such commands with the likes of
cd (change directory). Permissions work a bit differently. To access the admin folder, the Bash on Windows program requires the “Run as Administrator” privilege.
Want a super practical reason to use Bash for Windows? Server management is a great idea. Creating a server is really easy, but if it’s headless, you’ll need a way to manage it. There are loads of apps including PuTTY, but the command line offers a simple solution. Just ssh into the server and you can manage it from the terminal. Running remote scripts works quite well using Bash on Windows, and it’s a fantastic useful application.
Uninstall Bash for Windows
Once you’ve installed Bash for Windows, it’s fairly easy to uninstall. There are two main methods for accomplishing this: one removes Ubuntu environment but keeps your home folder intact. To accomplish this, run these commands via the command prompt or PowerShell:
A notification will then warn of the results of uninstalling: “This will remove the Ubuntu environment as well as any modifications and new applications…”
Type y to proceed with removal.
The alternative turns off the Windows Subsystem for Linux and this removes the Ubuntu environment and the home folder:
lxrun /uninstall /full
A notification warns:
“This will uninstall Ubuntu on Windows. This will remove the Ubuntu environment as well as any modifications, new applications, and user data.”
Type y to allow the removal of the software.
Bash on Windows packs loads of potential, and there are superb resources from the likes of the Windows blog, Ubuntu community sites, and even everyone’s favorite: Reddit. Conversations in the /r/bashonubuntuonwindows thread include running Visual Studio code, Samba file servers, and developing with WSL. As running graphical apps proved, the possibilities are almost infinite.
What are you currently using Bash on Windows for? Are you even running Bash on Windows? Let us know in the comments section below!