Getting started with Bash on Windows 10: A step-by-step guide

One of the really cool things about Windows 10 is that Microsoft has baked a full-blown Ubuntu-based Bash shell into the operating system. For those who might not be familiar with Bash, it is a text-based Linux command line environment. In other words, it is like having Linux on Windows, and now you can easily run Bash on Windows 10.

The Bash shell has actually been a part of Windows 10 for a while, but the technique used for enabling Bash on Windows 10 has changed over time. For the purposes of this article, I am going to assume that you are running Windows 10 with the Creators Update, or a newer version. If you are not sure which Windows 10 build you are using, then right click on the Start menu, and choose the System command from the shortcut menu. The resulting About Windows 10 screen lists various statistics about the operating system and the hardware that it is running on. Take a look at the OS Build, which you can see in the figure below. The build number I am basing this article is 15063.0 (version 1703). If your copy of Windows has an older build number (a lower number), then just run Windows Update to bring Windows up to date.

Bash on Windows 10
Be sure to check the OS Build before you get started

Bash on Windows 10: Let’s get started

Once you have checked the OS Build number, then the next step in the process is to install the Windows Subsystem for Linux. To do so, open an administrative PowerShell window, and run the following command:

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

You can see what this looks like in the next figure. You will also notice that installing this feature requires you to reboot your computer.

Bash on Windows 10
Enable the Windows Subsystem for Linux

Once the Windows Subsystem for Linux is installed, you are going to need to install Ubuntu user mode. Microsoft is talking about making it so that you can download Ubuntu from the Windows app store, but this option isn’t available just yet. For right now, you will have to enable Developer Mode, and then use the Command Prompt window to launch Bash.

Enabling Developer Mode is a simple enough process. Go to Settings, and then click on Update & Security. When you arrive at the Windows Update screen, click on the For Developers link. Next, you will have to turn on Developer Mode. As you can see in the figure below, Windows warns you that there are certain security risks associated with enabling Developer Mode, so you probably don’t want to use Developer Mode in a high-security environment.

Bash on Windows 10
Be sure to enable Developer Mode

It takes a minute or two for Developer Mode to be enabled. Once the process completes, go ahead and close the Settings window. The next thing that you will need to do is to open an administrative Command Prompt window. Microsoft has removed the Command Prompt option from the Start menu. You can launch a regular Command Prompt window by entering CMD at the Run prompt, but in this case we need an administrative Command Prompt. The easiest way to open an administrative Command Prompt window is to type the word Command into Cortana. You should see the Command Prompt listed among the search results. Right click on this result, and choose the option to run the Command Prompt as an administrator, as shown in the figure below.

Bash on Windows 10
Launch an administrative Command Prompt

When the Command Prompt window opens, type the word Bash, and press Enter. When you do, you will see a message saying that you are about to install Ubuntu on Windows, and that this is a beta feature. As you can see in the figure below, Windows gives you one last chance to change your mind about installing Bash. If you want to continue, then press Y.

Bash on Windows 10
After you press Y, Windows will download Ubuntu from the Windows app store. The interesting thing about this is that the download happens from within the Command Prompt interface, rather than using the usual Windows Store app. When the download completes, it takes Windows a few minutes to extract the Bash files.

Bash on Windows 10
Windows downloading Ubuntu from the Windows Store

When the extraction process finally completes, you will see a prompt telling you to enter a new UNIX username. This name will be used by the default UNIX user account, and the name that you choose does not have to match your Windows user name. The reason for this is that Windows maintains a completely separate authentication environment for Bash.

Bash shell

As you have probably already guessed, Windows also prompts you to enter and confirm a password to be used with the Bash on Windows 10 environment. Entering a password is a little bit disorienting, because nothing happens on screen to indicate that your key strokes are being registered. Finally, you are taken into the Bash shell, which you can see in the next figure.

Bash on Windows 10
Logged into Bash

There are two things to pay attention to in the screen capture above. First, the screen capture contains a message indicating that documentation is available at this Microsoft site.

The second thing to pay attention to is the message saying that if you want to run a command as Administrator (or root, as it is referred to in the Linux world), then you will need to use the word sudo. Let’s suppose, for instance, that you wanted to use the Date command to display the date, but for some crazy reason you needed to run that command as root. Here’s the commad you would use:
sudo date
As you can see in the example below, using the sudo option causes Bash to prompt you for a password.

Bash on Windows 10
Sudo command tells Bash to run the command as root

In case you are wondering, you don’t have to open a Command Prompt window every time you want to use the Bash on Windows 10 shell. The setup process installs a Start menu option that you can use in the future.

About The Author

4 thoughts on “Getting started with Bash on Windows 10: A step-by-step guide”

Leave a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Scroll to Top