How to install and use bash in Windows 10

0
143

Hello, how are you? Today we’re going to talk about a computer program well known to Linux users. This is Bash. It’s a POSIX-compatible Unix shell and the default shell on most GNU/Linux distributions, plus macOS. In addition, it is a computer program, whose function is to interpret commands and a console language. As mentioned, it is an essential tool for Linux users, but not so much for Windows users. However, for some time now Microsoft has been interested in the possibilities offered by free software. Specifically, since 2016, the company announced the development of the Windows Subsystem for Linux (WSL). This was later included in the operating system as an update, also Ubuntu appeared as a downloadable program in the Microsoft Store. An interesting innovation without a doubt, for that reason I will show you how to install and use Bash on Windows.

Introduction

First, let’s try to put into simple words what is WSL. What it does is integrate a GNU/Linux environment on Windows 10. It does not work with virtualization, on the contrary, the calls to the system are translated in real-time. It implements the Linux kernel API using the native Windows NT API. In other words, what Wine does in a GNU/Linux system, but vice versa. It does not incorporate the graphical interface of the distro Linux, but it does include its most powerful tool which is the bash command interpreter.

Enabling Windows Subsystem for Linux (WSL). Graphic mode.

In the first place, we have to prepare the system to be able to run Linux. And this is because this function is not activated by default. With this in mind, follow the next path: Control Panel>Programs>Turn windows features on or off

Control Panel>Programs>Turn windows features on or off
Control Panel>Programs>Turn windows features on or off

In the following box navigate to Windows Subsystem for Linux and select the checkbox to activate it. Then press OK to start the installation.

Turn window features on or off
Turn window features on or off

Once the system locates the necessary files for the installation, it will ask us to restart Windows to execute the changes.

Restart to apply the changes
Restart to apply the changes

Enabling Windows Subsystem for Linux (WSL). PowerShell mode

If you want to practice your command-line skills, you can activate this Windows function using PowerShel. You have to run it with administrator privileges. With this intention, press the Win+X combination and select Windows PowerShell(Admin).

Run a PowerShell as administrator
Run a PowerShell as administrator

In the console, you need to add the following command:

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

The PowerShell should look this way:

Enable WSL by using PowerShell
Enable WSL by using PowerShell

Installing Ubuntu 18.04 LTS

Once the machine is restarted, we just need to go to Microsoft Store and download some of the distro Linux available. For now, there are Ubuntu, OpenSuse, and CentOs, but no doubt there will be more in the future. For the purposes of this article, we will work with Ubuntu 18.04 LTS. Just press Get and wait until the installation is ready.

When the download is finished, we can launch the application. Just wait a few minutes while it is installed. Please choose your username (not necessarily the same as windows). Then assign a password, confirm it and the installation will be complete.

Ubuntu running on Windows 10
Ubuntu running on Windows 10

Testing Ubuntu in Windows 10

to access the application, just type Ubuntu in the search bar, and click on the program. once there it is enough to apply any valid command in Linux. In this example, we are going to update the list of packages in the repositories. To do this type the following command:

sudo apt-get update

Just enter the password, and you’ll see the Ubuntu shell in action!

Ubuntu shell running apt-get update command
Ubuntu shell running apt-get update command

Conclusion

We have seen how to install bash on Windows 10. This is a very interesting option for programmers. The Windows Subsystem for Linux allows users to execute bash commands such as grep, sed, and awk, as well as bash scripts and command-line Linux applications such as vim, emacs, and tmux. You will also have access to languages such as Javascript and node.js, Ruby, Python and C/C+, as well as services such as sshd, MySQL, Apache and Lighttpd. All right, that’s it for now, please share on your social networks and visit our post about Mobile Hotspot on Windows 10.

LEAVE A REPLY

Please enter your comment!
Please enter your name here