Linux on Windows 10 become a reality for users of Microsoft’s OS in 2016. The arrival of Bash shell allowed developers access to various Linux binaries on Windows, without switching or virtualizing a Linux environment.
This functionality is the deployment of a Linux distribution on top of Windows, with the advantage being that users were offered a native experience along with the ability to access their files and run applications right from within Windows.
Microsoft made it a big deal when it announced support for this on Windows 10 with version 1607, also known as the Anniversary Update. Dubbed the Windows Subsystem for Linux, this is necessarily a compatibility layer for running Linux binary executables natively on the operating system.
It’s not a full Linux implementation in the operating system.
But instead, a command processor, where you type commands to cause actions.
Think of this as the opposite of Wine, which is a software that allows users to run programs and games developed for Windows directly on Linux and other Unix based platforms.
Before we get down to the business of installing Bash on Windows 10 and deploying Linux software, it’s important to understand what exactly you are dealing with here. Microsoft developed a Linux compatible kernel interface for WSL so that users can run a GNU userland on top of it.
Technically speaking, the Windows Subsystem for Linux is not Linux at all.
Nor is it a virtual machine or a container.
That’s because the underlying OS kernel for Linux is not available here. The Bash shell allows you to run the same binaries that you would run on Linux. The subsystem has its roots in the unreleased Project Astoria, which Microsoft developed to enable Android apps on Windows 10 Mobile.
Designed primarily as a tool for developers working on open source projects, this is the most direct way to run Linux on Windows. It requires fewer resources than using virtualized machines, and users can use both Windows apps and Linux tools on the same set of files.
The Windows 10 Bash Shell
Microsoft initially teamed up with Canonical to offer a full Ubuntu based Bash shell environment to run on top of this subsystem. Since then, support for openSUSE, SUSE Linux Enterprise Server, Debian as well as Kali Linux is there for people that have more specific needs.
The Fall Creators Update moved the installation process for Linux distributions to the Windows Store.
And just a few days back, on March 26, Microsoft enabled custom Linux distributions on Windows 10 by open sourcing a sample for distribution maintainers that allows them to submit their distros to the Microsoft Store just like any other Windows 10 app.
Worth a mention that WSL does have some limitations.
For starter, it’s only available on the 64-bit versions of Windows 10, and this compatibility layer included in all x64 releases of the OS from Windows 10 version 1607 and later.
The feature itself is not perfect either, as it does not run 32-bit binaries of Linux software or applications that require unimplemented Linux kernel services. In fact, not every command line application works.
It doesn’t yet support background server software, and graphical Linux desktop applications don’t officially work here. There are a few workarounds to run some GUI applications, though most of them are unstable right now.
All that said, Microsoft continues to refine and optimize this key Windows 10 feature for developers.
Let’s now see how you can set things up and run it.
How to Install Bash on Windows 10?
As noted above, first make sure you are running a 64-bit version of Windows 10. If you are, then only fire up the Control Panel and then go to Programs > Turn Windows features on or off.
Here, enable the Windows Subsystem for Linux option in the list and then click the OK button.
Restart your system when are prompted, as the feature will not work until you reboot.
Do note that if you’re running a version of Windows before the Fall Creators Update, you’ll also be required to enable Developer Mode in the Settings app. But on the flipside, you do get the ability to install Ubuntu by running the bash command.
Newer versions of Windows 10 not only simplify the installation but also ask you to install your Linux distribution from the Store app — which is what we’ll do now.
Open the Microsoft Store application from the Start menu.
Now search for Linux in the Store. You’ll see a special section below that will allow you to install Ubuntu or any other distribution right from within the Store app.
To install a Linux distribution, merely click on it and then click the Get button to install it just like any other Store application. You can even install multiple Linux distributions this way, and each will get its different shortcut in Windows 10. It is also possible to run multiple ones at the same time.
If you’re unsure of which Linux distribution to install, Ubuntu is the obvious recommendation. This original distro was the only option available for Windows 10 users for quite some time, and it is perhaps the most popular choice amongst the Linux community anyway.
Using the Bash Shell
You now have a full command line bash shell at your disposal, based on whatever Linux distribution you install. Since it uses same binaries, you can use it to install software from repositories. Plus, you can also use all the commands you usually use on your Linux distro.
If you are well familiar with using Bash shell on other platforms like Linux and macOS, you will feel right at home here. And if this is your first time with this, then you will find that it is effortless to pick and play, with the Linux terminal sharing many similar commands with DOS, or Windows Command Prompt.
Here’s a table that lists these common commands between the two:
cd or chdir
Create a Directory
Remove a Directory
List contents in a directory
Copy a file
Move or rename a file
move and delete
Delete a file
del or erase
Use a text editor
vi or nano
Launch your installed Linux environment by running the wsl command. If you have multiple Linux distributions installed, Windows 10 allows you to choose the default environment this command launches.
And you can also directly launch your deployed environment by using their unique commands. For example, ubuntu for Ubuntu, opensuse-42 for openSUSE Leap 42 and sles-12 for SUSE Linux Enterprise Server 12.
The Microsoft Store pages for each distribution handily lists these commands.
It is also possible to launch your default Linux environment using the bash command, but Microsoft recently deprecated this, and this command may stop working in the future.
Of course, you will be prompted to enter a UNIX username and password the first time you launch the Linux environment. These can be unique and don’t have to match your Windows details. It’s a good idea to set up a different username and password for use within the Linux environment.
It is how the initial setup window looks.
Set up your details and note them down, so you don’t forget.
The rest is a standard affair. On Ubuntu, you will need to prefix a command with sudo command to get root permission, which in the world of Windows is Administrator access. Another difference is that unlike Windows, the Linux environment is case sensitive, so always be mindful of capitalization.
Installing Linux Software
Now we get to the fun part. Installing software on Bash in Windows 10 is, again, straightforward. On Ubuntu environments, you can use the apt command to install and update software. Prefixing them with the sudo command, of course.
On SUSE you can use the zipper command to install applications in your environment.
After you have downloaded and installed an application, type its name at the prompt and then press the Enter key to run it. The documentation for your given app will provide more details on how to run and manage it.
Important to note that the software that you install in the Bash shell is restricted to that environment, meaning they are not accessible for use directly from within the operating system. You can, however, access these programs from the Command Prompt or PowerShell from within Windows.
You’ll only need to run the bash -c command.
Installing the Ubuntu Font
Ubuntu fans also can install the Ubuntu font for a real experience. These can be installed just like any other font, with a simple registry edit to enable the font in the terminal. Follow these steps to get started.
Download the Ubuntu Font Family from the official website, open the ZIP file and locate the monospace font that is the one used in the terminal. The UbuntuMono-R.ttf is the font you need to install.
Once you install it in your system, you need to add the setting to the Windows registry. Open the Registry Editor by pressing Win + R keys on your keyboard and typing regedit.
Navigate to the following key:
Right-click in the right pane and select New > String Value and name it 000. Double click the string you just created and then enter Ubuntu Mono as its value data. Now, launch the Ubuntu window, right-click the title bar and then select the Properties command.
Click on the Font tab and then select Ubuntu Mono in the font list.
That's it, now enjoy Linux on your Windows 10 operating system.