How To Download and Install Linux Bash Shell On Windows 10? – POFTUT

How To Download and Install Linux Bash Shell On Windows 10?

Bash is the command-line interface for Linux distributions like Ubuntu, CentOS, Debian, Mint, Kali, RedHat, Fedora, etc. Bash provides a lot of different type of commands and tools to manage a Linux system. In this tutorial, we will learn how to install Bash on a Windows operating system like Windows 10.

What Is  Bash?

Bash is the most popular shell or command line used in Linux distributions. Bash alternatives are Sh, KornShell, CShell etc. Bash is the short form of the GNU Bourne-Again Shell and created in 1989 by the GNU supporter Free Software Foundation (FSF).

What Is  Bash?

What Is  Bash?

Windows Subsystem for Linux (WSL)

Containers are a new era of the Virtualization where provides less resource usage and less complexity. Containers provide isolated environments for applications, processes, files, etc like a virtual system. Docker is the most known and popular containerization system. Windows also started full and complete container usage on Windows for Linux. It is called Windows Subsystem for Linux (WSL). Which means the Linux operating system calls and standards are provided as a container on a Windows operating system. WSL is currently supported by the modern Windows operating systems like Windows 10 and Windows Server 2016 and 2019.

Bash Installation

In order to install Bash on Windows, we will enable the WSL and download a Linux container image like Ubuntu, SUSE, etc from Microsoft store. Then we will run this container from the Windows command line MS-DOS or PowerShell.

Enable Windows Subsystem For Linux

First, we will enable or install Windows Subsystem For Linux (WSL) with the PowerShell.  We need Administrative features enabled by running PowerShell from Start Menu where we will right-click and then select Run as administrator.

Enable Windows Subsystem For Linux

Enable Windows Subsystem For Linux

We will run the following Enable-WindowsOptionalFeaturecommand in order to install and enable Microsoft-Windows-Subsystem-Linux feature.

LEARN MORE  How To Redirect Stderr To Stdout In Linux Bash?

Enable Microsoft-Windows-Subsystem-Linux

Enable Microsoft-Windows-Subsystem-Linux

We will be asked is we want to restart the computer after the installation is complete. We will answer Y.

Restart The Computer

Restart The Computer

This will restart the system automatically in order to start the Windows with the WSL enabled.

Download Linux Image/Distributions From Windows Store

In order to run bash, we have to download a Linux image/distributions which will provide the bash shell. Linux distributions can be downloaded from the Microsoft Store like below. We can access Microsoft Store from start menu with Microsoft Store keyword.

Download Linux Image/Distributions From Windows Store

Download Linux Image/Distributions From Windows Store

We will write linux to the search box and search. Alternatively, if we are looking for a specific Linux

Search Linux Images

Search Linux Images

The search results for the Linux container will be listed like below. We can see that Linux distributions like Kali, Ubuntu, Debian, Suse, etc. Following information also provided with the search results.

  • Popularity provides the count of the rating provided the given Linux distribution image.
  • Rating is the provided points or starts for the given Linux distribution.
  • Supported Systems shows which environments can run given Linux image like Computer, Phone etc.
  • Price is generally zero but used to show the price of the given Linux image.
WSL Linux Images List

WSL Linux Images List

WSL Ubuntu Image

WSL Ubuntu Image

We will select the  Linux distribution like Kali, Ubuntu, Debian, SUSE like below just click them. In this example, we will select the Ubuntu image with the latest version. Ubuntu 18.04 LTS can be downloaded to for Lon Term Support.

WSL Ubuntu Image Download

WSL Ubuntu Image Download

During the download, the download status will be shown in the header like below. We can see that the Ubuntu image is about 221 MB and downloaded very fast.

WSL Ubuntu Image Download

WSL Ubuntu Image Download

Launch Bash From Microsoft Store

When the download is complete we can launch Ubuntu container from the Microsoft Store from the Launch button like below.

Launch Ubuntu Container On Windows

Launch Ubuntu Container On Windows

We will see following bash shell where it is initialized for the first run. As it says it may take a few minutes to see the shell.

Ubuntu Shell

Ubuntu Shell

Before starting to use bash we will be asked some basic questions like the username and password which will set. In this example, we set the username ismail.  The password is not shown for security reasons. We see that the hostname part of the bash shell is the name of the computer which is DESKTOP-HQVAMA3 and the user name is ismail.

Linux Bash Shell On Windows 10

Linux Bash Shell On Windows 10

Start Bash From MS-DOS and PowerShell

We can also start the Bash from the command line. MS-DOS or PowerShell can be used to start bash shell with the bash command like below.

LEARN MORE  What is Microsoft Powershell ? How Can I Automate Tasks?

OR

Start Bash From MS-DOS

Start Bash From MS-DOS

Start Bash From PowerShell

Start Bash From PowerShell

Run Bash Commands On Windows

We can run any Linux bash command on Windows like below. In this part, we will run commands like ping, uname , lsb-release.

Run Bash Commands On Windows

Run Bash Commands On Windows

Access Windows Drives C:\ , D:\

After starting the bash on Windows we may need to access Windows partitions like C:\ , D:\, and the users Documents and Settings folders. These partitions and folders are mounted in /mnt directory with their partition names. In this following example, we see the folders are listed in the C:\ partition.

Access Windows Drives C:\ , D:\ 

Access Windows Drives C:\ , D:\

Leave a Reply

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

Enjoy this blog? Please spread the word :)