Home>Posts>Tech Explained>How To Enable Bash for Windows 10 & 11

How To Enable Bash for Windows 10 & 11

By ·Categories: Tech Explained·Published On: July 17th, 2022·5.1 min read·

Ubuntu Linux Bash for Windows is a powerful tool that enables users to access Unix commands and software without needing to setup a dual-boot system or installing and managing a Virtual Machine. As Microsoft continues to improve support for Windows System for Linux, or WSL, the process for enabling and installing the Ubuntu Bash shell becomes increasingly easy for the user, but it is still not strictly intuitive. Here’s what you need to do.

Step-by-step instructions on how to install Ubuntu Linux Bash in Windows 10

The first step to enabling Bash in Windows 10 & 11 is determining which version of the Windows Subsystem for Linux (WSL) is right for you. While they both provide seamless integration of Linux within Windows, WSL 1 and WSL 2 operate on different architectures and will be beneficial for different use cases.

Which Windows subsystem for Linux (WSL) is right for you?

WSL 1 operates as a compatibility layer, allowing the user to run Linux binary executables on Windows. This layer translates Linux system calls into Windows system calls and then executes them natively within Windows. This architecture requires any updates to the Linux kernel to be implemented separately by Windows which adds additional time to the update process. The translation of commands also causes WSL 1 to suffer from poor I/O (input/output) performance for tasks such as database management, Git operations, and package installation and updates. The key benefit of WSL 1 is the ability to access project files natively in the Windows file system. 

WSL 2, on the other hand, is a full Linux kernel operating within a managed Virtual Machine (VM). The kernel is updated during normal Windows updates and is built off the latest stable branch which can be found at kernel.org. The benefits of this architecture include full system call compatibility. This enables applications that were previously impossible to run on WLS 1 due to lack of support from the translation layer, such as Docker. 

Not requiring a system call translation significantly speeds up multiple functions leading to a 2-5x speed increase for tasks such as Git clone. A third benefit of this architecture is that Linux kernel updates are immediately available for use and do not need to be implemented in the WSL 1 translation layer then pushed to users. The WSL 2 managed VM environment, unlike a traditional VM, is designed to boot quickly, optimize resource usage, and require no direct user management.

For most users, it is recommended to use WSL 2 due to the increased application compatibility, faster I/O speeds, and quicker kernel update cycles. WSL 1 is recommended only when your project files must be stored in the Windows 10 file system or your project files will require cross-compilation using Windows and Linux tools.  

Check your Windows 10 version

Make sure you are running a supported version of Windows 10.

For WSL 1, you need the Windows 10 Fall Creators, Version 1709 or higher, and for WSL 2, you will need to be updated to the May 2020 Update, Version 2004 or higher. Check out this information from Microsoft for more information – What’s the difference between WSL 1 and 2?

To check your version of Windows 10: 

  1. Select Start and then select Settings 
  2. In Settings, select System > About
  3. Scroll down to Windows Specifications

Alternatively, you can hold the Windows button on the keyboard and tap the R key. Type in “winver”, then press enter.

Windows specification box used to determine version of Windows 10

Note: You won’t need to check what version of Windows you are running if you are running Windows 11, as this software is compatible with all Windows 11 versions.

Enabling Windows subsystem for Linux

Next, you’ll need to enable the Windows Subsystem for Linux. To do this, you will need to open PowerShell as an Administrator and run the command corresponding to your desired WSL version.

To enable WSL 1 run the command:

  • dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

For WSL 1 you can now skip to the “Install Ubuntu for Windows 10” step

To enable WSL 2 run the below commands:

  • dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
  • dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

Once your command has successfully completed, restart the operating system.

WSL 2 Powershell screen shot

Install Linux kernel update package

Download the WSL Linux kernel package update for x64 systems. You can download by clicking here.

Run the .msi installer downloaded.

Update Setup Wizard complete message for WSL Update

Set WSL 2 as the default version

In powershell, run the command:

  • wsl –set-default-version 2

Screenshot of powershell window while setting WSL 2 as default version

Install Ubuntu for Windows

Ubuntu is available for free from the Microsoft Store:

  1. In the start menu, type “Microsoft Store” and hit enter. Or click here for the web browser version of the store.
  2. Search “Ubuntu” and select the top result, “Ubuntu” published by Canonical Group Limited.*
  3. Click ‘Get’ and follow any further on screen instructions.

Windows store Ubuntu

Ubuntu confirmation window

The Microsoft Store will handle the download and installation as well as reporting progress.

*At the time this article is being written, Ubuntu 20.04 LTS will be installed following this method. 18.04 can also be found on the Microsoft Store if needed for compatibility purposes.

Launching Ubuntu

With the Microsoft Store installation complete, Ubuntu can now be launched like any other Windows application from the start menu.

Screen shot showing how you launch Ubuntu from Windows

On first launch, Ubuntu will notify you that it is installing and to wait for the process to complete. When the installation finishes, you will be prompted to create a new shell username and password. 

Note: These credentials do not need to match your windows credentials.

Screen shot showing bash command line

Once complete, and for future launches, you will find yourself at the Bash command line.

Congratulations! You have completed the setup and installation of Ubuntu Linux Bash terminal for Windows 10 & 11!

Note: This blog was originally created on August 1, 2016. It was updated on July 17th, 2022, with updated details.

Get the Latest Tech Updates

Subscribe to our newsletters to get updates from OnLogic delivered straight to your inbox. News and insights from our team of experts are just a click away. Hit the button to head to our subscription page.

Subscribe Now

Share

About the Author: Eric Nachtigal

Eric is a Hardware Applications Engineer for OnLogic which means that he works to find solutions to unique customer challenges as well as validating upcoming technology and products. In his free time, Eric enjoys the great outdoors including camping, hiking, skiing, climbing, and paddling.
Follow OnLogic on LinkedIn

SHARE

Have a project? Let's talk

More Articles

WHITEPAPER

Learn the 5 ways Fanless Computers can help your business

Get the Whitepaper
View All Articles

OnLogic Industrial Computers

Discover OnLogic's multitude of industrial computers that will help you to advance your IoT project

Shop OnLogic

Learn more at OnLogic.com

OnLogic Industrial PCs: Designed to last. Built to order. Delivered in days. Visit our online store at OnLogic.com