This article explains how to enable Linux Bash Shell with WSL 2 on Windows 10. Microsoft added Linux Bash Shell support to Windows 10 that allows users to run Linux on Windows. This is done with Windows Subsystem for Linux (WSL) that allows you to install your choice of Linux Distro on Windows. Now, Windows released version 2 of WSL that brings support for Linux kernel on Windows 10.
WSL 2 has significant advantages over the WSL 1. The WSL 2 comes with a real Linux kernel which makes a lot faster than WSL 1. WSL 2 takes lesser time to compile programs and load I/O commands. Apart from that, it also expands the limit command support on WSL 1 with full Linux support.
To get WSL 2 on Windows 10, you must have Linux Bash Shell enabled and WSL 1 installed. Do note that the WSL 2 is only available in Windows 10 builds 18917 or higher.
Enable Linux Bash Shell with WSL 2 on Windows 10
If you have the WSL 1 already enabled on your PC, you can skip to the “Enable WSL 2 on Windows 10” section, otherwise, follow this step by step guide to first enable Linux Bash Shell and install WSL on Windows.
Enable Linux Bash Shell (WSL 1) on Windows 10
To enable WSL on Windows 10, press the Windows button on your keyboard and search open ‘Turn Windows Features on or off’. In the ‘Windows Features’ window, look for “Windows Subsystem for Linux” and enable it. It will take a few minutes to find and installed the required files on your PC. Once done, reboot your PC.
Now, the WSL is enabled on your PC, all you have to do is install a Linux Distro of your choice. The following links will open the Microsoft store page for each distribution:
- Ubuntu 16.04 LTS
- Ubuntu 18.04 LTS
- OpenSUSE Leap 15
- OpenSUSE Leap 42
- SUSE Linux Enterprise Server 12
- SUSE Linux Enterprise Server 15
- Kali Linux
- Debian GNU/Linux
- Fedora Remix for WSL
- Pengwin Enterprise
- Alpine WSL
Choose the Linux Distro that you want to get and install that from the Windows Store. For example, I choose Ubuntu and install it from the Windows Store. Doing this adds an app for the same on your PC. Running that app opens the Linux terminal with Bash Shell.
On the first run, you get options to set username and password. After that, you can use the Linux Bash Shell on Windows 10.
Enable WSL 2 on Windows 10
Once you have got the Linux terminal working on Windows 10, you can upgrade it to WSL 2. Before going any further, make sure your Windows 10 build is 18917 or higher. This build is currently distributed to Windows Insiders. After confirming your Windows build, open ‘Windows Features’ again and this time enable “Virtual Machine Platform” and reboot your PC.
After reboot, open Windows PowerShell with Administrator permission and run the following command:
wsl --set-version <Distro> 2
for example, in the case of Ubuntu, replace Distro with Ubuntu
wsl --set-version Ubuntu 2
When you run the above-mentioned command, it will take a few minutes and install WSL 2 on your PC. WSL 2 brings real Linux kernel on Windows 10 will full Linux commands support.
With WSL 2, Mircosoft is bringing real Linux kernel on Windows 10. This will allow developers to run native Linux app and Ubuntu GUI on Windows. By adding full support for Linux, Microsoft is making Windows a decent development platform for programmers and students.