Before we see how to run Bash on Ubuntu on Windows, here’s a little bit about Microsoft’s amazing step of integrating user mode Linux and its tools into Windows OS. Who would have thought one would be running native Bash directly on Windows?
At the start of the Windows cycle, Microsoft opened a user-voice page and started a conversation about the Windows command line. They asked the community what they liked about the command line and what features they would like to see in it.
Many in the community replied that they would like to see improvements to the Windows Command line. Others said they would like to bring Linux/Unix tools to Windows. As working with open-source tools on Windows is often a struggle, users said that they would like Microsoft to make it easier to use these tools on Windows.
Listening to the community voice, Microsoft first improved CMD, PowerShell and many other Windows command-line tools and secondly did what was unbelievable few years back. Microsoft decided to add real, native Bash and with it support for Linux command-line tools which run directly on Windows in an environment that behaves like Linux! Its not any VM but the real Linux on Windows.
Windows Subsystem for Linux
For this Microsoft built new infrastructure within Windows – the Windows Subsystem for Linux (WSL) upon which genuine Ubuntu user-mode image is run provided by its partner Canonical, creators of Ubuntu Linux.
This will make Windows developers far more productive and use these tools much more seamlessly. And this will be a long-term solid, reliable, and stable solution.
Here is what Mark Shuttleworth, founder of Canonical said:
“In our journey to bring free software to the widest possible audience, this is not a moment we could have predicted. Nevertheless, we are delighted to stand behind Ubuntu for Windows, committed to addressing the needs of Windows developers exploring Linux in this amazing new way, and are excited at the possibilities heralded by this unexpected turn of events.”
What is Bash in Linux
For those who do not know, Bash or Bourne Again shell is a standard GNU Linux Shell program.
According to Wikipedia, Bash is a Unix shell and command language for the GNU Project as a free software replacement for the Bourne shell. it has been distributed widely as the shell for the GNU operating system and as a default shell on Linux and OS X.
Run Bash on Ubuntu on Windows 11/10
Starting with Windows 10, Windows Subsystem for Linux has been provided. Starting with this build, one can run native Bash on Ubuntu in Windows. This is how one does it.
-
First one has to turn on Developers Mode from
-
Settings > Update & Security > For Developers. Check the Developer Mode radio button. And search for “Windows Features” , choose “Turn Windows features on or off”.
-
Select “Windows Subsystem for Linux (Beta)” . Press OK.
-
It will start searching for the required files and starts applying changes. Once done, one has to reboot to finish installing the requested changes. Press Restart now.
-
-
Once rebooted, from the Start button right click and open Command Prompt (Admin) or PowerShell.
-
Type “bash” at command prompt and Enter. You’ll get a message “This will install Ubuntu on Windows, distributed by Canonical and…” . Type “y” to continue. Press ‘y’ and your download from the Windows Store starts. After downloading, it will start extracting the file system. This will take some time, so be patient.
-
After sometime you’ll get the message “Installation Successful! The environment will start momentarily…” and you’ll be at the Bash prompt.
-
-
From here on , now you can run Bash scripts, Linux command-line tools like sed, awk, grep and you can even try Linux-first tools like Ruby, Git, Python, etc. directly on Windows. One can also access Windows filesystem from within Bash.
-
After installing, it’ll also be listed in the App list. So that one can open All apps and click on “Bash on Ubuntu on Windows” to open Bash prompt.
Remember, this is a developer toolset to help you write and build code for all your scenarios and platforms. It is not a server platform upon which you will host websites, run server infrastructure, etc.
This is one of the coolest things to happen to Windows, so you must give it a try if you are interested in Linux or Ubuntu on Windows.
Source: Windows.com.
You can also check out this video tutorial by Scott Hanselman:
Visit his blog for additional information.
How do I open Bash on Ubuntu in Windows 11/10?
To open Bash on Ubuntu in Windows 11 or Windows 10, you need to install it first. Before that, you must install the Windows Subsystem for Linux, which you can do from the Windows Features panel. Following that, open a Command Prompt window and enter the bash command. Let it finish the installation process to open the Bash on Ubuntu.
Read: PowerShell vs Bash differences explained
How do I run Ubuntu shell on Windows?
To run the Ubuntu shell on Windows 11 or Windows 10, you need to install the Windows Subsystem for Linux first. Then, you can enter the bash command to install the Bash on Ubuntu. Once the installation is done, you can run the Bash on Ubuntu on Windows.