Install bash for windows

Warp Terminal

When Microsoft’s CEO announced that the Bash shell was coming to Windows, several people couldn’t believe it. #BashOnWindows trended on Twitter for days; such was the impact of this news.

Initially referred as Bash on Windows, it is actually called Windows Subsystem for Linux, popularly known as WSL.

With WSL, you can install one of the supported Linux distribution inside Windows and use the Windows terminal to access the Linux systems and run Linux commands.

In this tutorial, you’ll learn how to enable WSL on Windows and then install a Linux distribution of your choice.

📋

This tutorial was tested with the latest Windows 11 version 22H2, and build 22621.819. You might need to update your Windows installation if you have an older build to follow everything in this tutorial.

What is WSL?

WSL (formerly Bash on Windows) provides a Windows subsystem, and Linux runs atop it. It is not a virtual machine or an application like Cygwin. It is a complete Linux system inside Windows 10/11. It allows you to run the same Bash shell you find on Linux. You can run Linux commands inside Windows without installing a virtual machine or dual-boot Linux and Windows.

You install Linux inside Windows like a regular application. This is a good option if your main aim is to learn Linux/UNIX commands.

Check for System Compatibility

You must be running specific versions of Windows for the different features described in this article. Requirements necessary for a particular feature to work are described under its titles. To check your Windows version, search for about in the start menu.

search about in start menu

Search about in the Start Menu

Here, you can see the build of your PC, as shown in the screenshot below. Make sure it is matching with the respective requirements described under various sub-headings here in this article.

checking build number of windows

Checking the build number of Windows
  • You must be running Windows 10 version 1607 (the Anniversary update) or above.
  • WSL only runs on 64-bit versions 32-bit versions are not supported.

Install Bash in Newer Windows 10 and 11

The good thing is that the latest set of upgrades, including the stable release of WSL v1.0 released from Windows, makes it easier to install Bash on Windows.

There are two ways you can go about it:

  1. You can get it in one click from Windows Store.
  2. Choose to use the command-line.

1. Install WSL Using the Microsoft Store

wsl on microsoft store

Launch the Microsoft Store and search for «Windows subsystem«.

Install it, and you’re done with the first step. Next, you have to install a Linux distribution.

So, if you try to open WSL, you will get to see a window informing you that no distribution is installed.

command prompt asking to continue installing distributions

Similar to WSL, search for the distribution on Microsoft Store, and then install it.

For instance, I installed Ubuntu from the store as shown in the image below:

ubuntu 22.04 lts wsl on microsoft store

And, then proceed to «Open» it and it will automatically start installing. The procedure is same for any distribution you choose.

We then have to configure it, which is discussed right after installing it through the command line.

2. Install WSL and the default distribution using the command-line

In WSL, the default distribution is Ubuntu (which can be changed). To install, open Powershell as an administrator.

For this, search for Powershell in the start menu, right-click on Powershell and select Run as Administrator.

run powershell as an administrator

Run Powershell as an administrator

Inside Powershell, enter the following command to install WSL, along with all necessary features and the default distribution, that is, Ubuntu.

wsl --install

Once finished downloading and installing, you need to reboot to apply the changes.

Whether you installed WSL and Ubuntu using the Microsoft Store or the command line, you need to configure it.

Here’s how it is done:

🛠️ Configure the newly installed Ubuntu

After rebooting, search for Ubuntu in Start Menu and open it.

open ubuntu from windows 11 start menu

Open Ubuntu from Windows 11 start menu

It will ask you to enter a UNIX Username and Password. Enter these details and press enter key.

enter unix username and password

Enter UNIX username and password

You will now be inside the terminal window of Ubuntu.

logged into new ubuntu 22.04 lts in windows 11 wsl

Logged into new Ubuntu 22.04 LTS in Windows 11 WSL

Once logged in, you need to update the installed Ubuntu. For this, enter the following commands one by one:

sudo apt update
sudo apt full-upgrade

After completing the update, you are good to go with Ubuntu in WSL.

running ubuntu in wsl 1

Running Ubuntu in WSL

Install Bash on Older Windows

If you have the minimum requirements mentioned in the beginning but are running an older Windows build, the previous method may not be supported. So there is a manual installation method.

Also, there are both WSL1 and WSL2 available. WSL2 offers some upgraded functionalities but has some minimum requirements to run:

  • For x64 systems: Version 1903 or later, with Build 18362 or later.
  • For ARM64 systems: Version 2004 or later, with Build 19041 or later.

So this brings us to two possibilities to install:

  1. Install Ubuntu with WSL1
  2. Install Ubuntu with WSL2

1. Install Ubuntu with WSL 1

This is a relatively simple procedure for those with a system incompatible with WSL2. First, you need to enable the Windows Subsystem for the Linux feature. This can be done through the command line. Open Powershell as an administrator and enter the following command:

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

Or, to do this via GUI, follow the steps below:

windows 10 features enable/disable menu

  1. Search for Windows Features in Start Menu.
  2. Turn on Windows Subsystem for the Linux feature.
  3. Reboot your system.
  4. Open the Windows store and search for the distribution of your choice to install.

Once installation is completed, open the Ubuntu app from the start menu. It will take a couple of seconds to install. You will be prompted to enter a username and password. Provide those credentials, and you are good to go with Ubuntu in WSL1.

2. Install Ubuntu with WSL 2

It is recommended to use WSL2 instead of WSL1 if you have support. To install Ubuntu with WSL2, you need to make sure that the Windows Subsystem for Linux feature is turned on. For this, as in the above case, execute the following command in an elevated Powershell:

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

Reboot the device once the command is completed.

After this, you need to enable the Virtual Machine Platform feature. Open the Powershell with admin privileges and enter the following command:

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

Once again, restart the device to complete the WSL install and update to WSL 2.

Now, download the Linux Kernel Update Package for x64 machines from the official website. If you are using ARM64 devices, use this link to download the latest kernel update package.

If you are not sure about the device architecture, enter the command below in Powershell to get the type:

systeminfo | find "System Type"

When the file is downloaded, double-click on it and finish the installation of the Kernel update package.

Now, open PowerShell and run this command to set WSL 2 as the default version when installing a new Linux distribution:

wsl --set-default-version 2

Once WSL2 is set as the default version, you can now install the Linux distribution of your choice.

Go to Windows Store and install Ubuntu, as described in the earlier steps. and the rest of the procedure is already described above.

Enjoy Linux inside Windows.

🔧 Troubleshooting Tip 1

«The WSL optional component is not enabled. Please enable it and try again.»

You may see an error like this when you try to run Linux inside Windows 10:

The WSL optional component is not enabled. Please enable it and try again.
See https://aka.ms/wslinstall for details.
Error: 0x8007007e
Press any key to continue...

And when you press any key, the application closes immediately.

The reason here is that the Windows Subsystem for Linux is not enabled in your case. You should enable it as explained in this guide. You can do that even after you have installed Linux.

🔧 Troubleshooting Tip 2

Installation failed with error 0x80070003

This is because Windows Subsystem for Linux only runs on the system drive i.e. the C drive. You should ensure that when you download Linux from the Windows Store, it is stored and installed in the C Drive.

On Windows 10, go to Settings -> Storage -> More Storage Settings -> Where new content is saved: Change where new content is saved and select C Drive here.

windows 10 new app storag location

On Windows 11, go to Settings -> System -> Storage -> Advanced storage settings -> Where new content is saved and select C Drive here.

select the c drive as storage space for new apps in windows 11 settings

Select the C-Drive as storage space for new apps in Windows 11 settings

🔧 Troubleshooting Tip 3

«Failed to attach disk Error»

Sometimes, this error will appear when we reinstall the Ubuntu in WSL.

file not found error in wsl

File not found error in WSL

In this case, open Powershell and run the following command:

wsl -l -v

This will list the installed Linux systems. Find the name of the system, that is throwing the error, in my case Ubuntu. Now run the following command:

wsl --unregister Ubuntu

You can restart the ubuntu app and it will run without any issues.

You can refer to more common troubleshooting methods from the official website.

Run GUI Apps On Windows Subsystem for Linux

The ability to run GUI apps on Windows Subsystem for Linux was introduced with the WSL 2 release in May 2020.

Windows Subsystem for Linux (WSL) with WSL2 now supports running Linux GUI applications (X11 and Wayland) on Windows in a fully integrated desktop experience. This allows you to install Linux applications and seamlessly integrate them into Windows desktop, including features like “pin to taskbar”.

📋

One crucial point is that you must be on Windows 10 Build 19044+ or Windows 11 to access this feature.

Step 1: Enable/Update WSL 2

This procedure has been explained in the above section and you can refer to it.

Step 2: Download and Install Graphics drivers

To run GUI apps, you need to install appropriate graphics drivers. You can use the following link to download the drivers according to your provider.

  • Intel GPU Driver for WSL
  • AMD GPU Driver for WSL
  • NVIDIA GPU Driver for WSL

Once installed, you are all done.

Step 3: Install some GUI Apps

Now, go to your Ubuntu app and install any GUI app using the APT package manager. You should note that running apps from other sources like flatpak are problematic within WSL.

For this article, I installed the Gedit text editor using the following command:

sudo apt install gedit -y

This will install several MB of packages including required libraries. Once completed, you can run the following command to start the GUI Gedit app in Windows.:

gedit
run gedit text editor gui in wsl ubuntu

Run Gedit text editor GUI in WSL Ubuntu

Similarly, you can install all the popular applications available to Linux, including Nautilus file manager, GIMP, etc. For more about running GUI applications in WSL, you can refer to the official documentation.

Install Linux Bash Shell on other older Windows 10

If you cannot get the Fall Creator’s update on Windows 10 for some reason, you can still install it if you have the Anniversary update of Windows 10. But here, you’ll have to enable developer mode. I still recommend upgrading to the Fall Creator’s update or the latest Windows 10 2004 version update though.

Press Windows Key + I to access Windows system settings. Here, go to Update & Security:

select updatesecurity option in windows system settings

Select Updates&Security option in Windows system settings

From the left side pane, choose “For developers.” You’ll see an option for “Developer mode.” Enable it.

select for developers option from the side pane

Select For Developers option from the side pane

Now search for Control Panel and in Control Panel, click on “Programs”:

select programs from the windows control panel

Select Programs from the Windows Control Panel

In Programs, click “Turn Windows features on or off”:

select turn windows feature on or off from programs and features section

Select Turn Windows features on or off from the Programs and Features section

When you do this, you’ll see several Windows features. Look for “Windows Subsystem for Linux” and enable it.

select the windows subsystem for linux checkbox

Select the Windows Subsystem for Linux checkbox

You’ll need to restart the system after doing this.

restart the device to apply the changes

Restart the device to apply the changes

After restarting the computer, click the start button and search for “bash”.

select bash from windows start menu

Select Bash from Windows Start Menu

When you run it for the first time, you’ll be given the option to download and install Ubuntu. You’ll be asked to create a username and password during this process. It will install an entire Ubuntu Linux system, so have patience as it will take some time in downloading and installing Linux on Windows.

running ubuntu inside windows

Running Ubuntu inside Windows

Once this is done, go back to the Start menu and search for Ubuntu or Bash.

search for ubuntu or bash in windows start menu

Search for Ubuntu or Bash in Windows Start Menu

Now you have a command line version of Ubuntu Linux. You can use apt to install various command line tools in it.

checking the working of bash shell in windows

Checking the working of Bash shell in Windows

💬 I hope you find this tutorial helpful for installing bash on Windows and experimenting with Linux GUI apps on Windows. No wonder WSL lets you play with Linux inside of Windows. If you have questions or suggestions, feel free to ask.

To download and set up the Windows Bash terminal, you can enable the Windows Subsystem for Linux (WSL) and install a Linux distribution via PowerShell using the following command:

wsl --install

Understanding Bash

What is Bash?

Bash, or Bourne Again SHell, is a command line interpreter that is widely used in Unix and Linux environments. It allows users to execute commands, run shell scripts, and perform complex automation tasks with ease. This command line tool serves as a bridge for users to interact with their operating system, enabling them to control files, manage processes, and execute scripts.

Why Use Bash on Windows?

Using Bash on Windows can significantly streamline your workflow, especially if you are accustomed to Linux. The ability to use Unix commands in a familiar Windows environment allows developers and system administrators to perform tasks swiftly and efficiently. For instance, Bash commands for file manipulation, such as `cp` for copying files or `rm` for removing files, make it easier to manage data without navigating through GUI-based file explorers.

Mastering Windows Bash Terminal Lambda Commands

Mastering Windows Bash Terminal Lambda Commands

Installing Bash on Windows

Different Methods to Install Bash on Windows

There are several methods to install Bash on Windows, particularly through the Windows Subsystem for Linux (WSL), Git Bash, and Cygwin. Each method has its own advantages depending on your needs.

Installing Bash via Windows Subsystem for Linux (WSL)

What is WSL?

The Windows Subsystem for Linux (WSL) enables users to run a full-fledged Linux distribution alongside their Windows installation. This allows you to use native Linux command-line tools without the need for a virtual machine or dual-boot setup. With WSL, you can utilize Bash and access a broad array of Linux applications seamlessly.

Steps to Install WSL

  • Step 1: Enable WSL feature
    First, you need to enable the WSL feature on your Windows system. Open a Command Prompt or PowerShell as an administrator, and run the following command:

    dism.exe /Online /Enable-Feature /FeatureName:Microsoft-Windows-Subsystem-Linux /All /LimitAccess /Source:wimgapi
    
  • Step 2: Install a Linux Distribution
    After enabling WSL, you can install a Linux distribution. Popular choices include Ubuntu, Debian, and Fedora. To install Ubuntu specifically, you can run this command:

    wsl --install -d Ubuntu
    
  • Step 3: Verify Installation
    Once the installation completes, it’s crucial to verify that Bash is functioning correctly. Simply run the following command:

    bash --version
    

This command should return the version of Bash installed, confirming that the installation was successful.

Installing Git Bash

What is Git Bash?

Git Bash provides a BASH emulation environment for Windows, allowing you to use Unix commands and Git features. It’s a lightweight alternative for users who want to execute Bash commands without needing the full power of WSL.

Steps to Install Git Bash

  • Step 1: Download Git Bash
    Begin by visiting the official Git website to download the Git Bash installer for Windows.

  • Step 2: Run the Installer
    Launch the installer and follow the guided prompts. During installation, you will encounter a series of options; it is usually recommended to use the default settings unless you have specific needs.

  • Step 3: Launching Git Bash
    After the installation is complete, you can access Git Bash through your Start Menu. When you open it, you will see a terminal that resembles a Linux shell, and you can start entering Bash commands right away.

Installing Bash with Cygwin

What is Cygwin?

Cygwin is a software package that provides a Linux-like environment for Windows. It offers a large collection of GNU and Open Source tools that provide functionality similar to a Linux distribution.

Steps to Install Cygwin

  • Step 1: Download Cygwin Setup
    Go to the official Cygwin website and download the setup executable that corresponds to your Windows architecture (32-bit or 64-bit).

  • Step 2: Run the Installer and Select Packages
    Run the downloaded setup file. During the installation process, you will have the option to select packages. For a complete Bash experience, ensure you include core packages such as `bash`, `coreutils`, and `gcc`.

  • Step 3: Finalizing the Installation
    After completing the installation, open the Cygwin terminal, where you will be greeted with a Bash prompt similar to other Bash environments. This prompts you to start executing your commands in a Unix-like fashion.

Mastering the Bash Terminal: Your Quickstart Guide

Mastering the Bash Terminal: Your Quickstart Guide

Verifying the Installation

Checking Bash Availability

After installation, you should verify whether Bash is available by running the following command in your terminal of choice:

echo $SHELL

This command should return the path to the Bash shell, affirming its installation.

Running Your First Bash Command

Once you have confirmed that Bash is installed and functioning, try running a simple command to familiarize yourself with the environment. For instance:

echo "Hello, World!"

This command will print «Hello, World!» to the terminal, demonstrating that Bash is operational. Another useful command to check your current directory contents is:

ls -la

This will list all files in the current directory, including hidden files, with detailed information.

Bash Download: Mastering File Retrieval in Bash

Bash Download: Mastering File Retrieval in Bash

Troubleshooting Common Issues

Common Installation Problems

During installation, you may encounter problems such as feature-related errors or issues downloading your selected Linux distribution. To resolve these problems, ensure that your Windows version is up to date and that virtualization support is enabled in your BIOS settings for WSL.

Reinstalling Bash

If you experience issues with Bash after installation, a cleanup and reinstall might be necessary. Uninstall the Linux distribution from Windows settings or use `wsl —unregister <distro_name>`. Then, re-follow the installation steps to ensure everything is set up correctly.

Quick Guide to Git Bash Download for Beginners

Quick Guide to Git Bash Download for Beginners

Conclusion

Installing Bash on Windows enhances your ability to perform tasks efficiently and expands your command-line skills. With options like WSL, Git Bash, and Cygwin, you can choose the method that best fits your workflow. The command line is a powerful tool, and getting accustomed to Bash commands will undoubtedly improve your productivity. As you explore further, remember to dive into more complex scripts and versatile Bash functionalities to maximize your use of the Windows Bash terminal download capabilities.

Mastering Windows Bash Script: A Quick Guide

Mastering Windows Bash Script: A Quick Guide

Additional Resources

To continue your learning journey in Bash, consider exploring official documentation for WSL, Git Bash, and Cygwin, along with online tutorials, forums, and community support. These resources will provide deeper insights and assistance as you build your skills and tackle various command-line tasks efficiently.

Summary: Learn about the Windows Subsystem for Linux that runs on top of Windows 10.

Today we have a guest article written by Stefan Roth. Take it away Stefan …

Hi, my name is Stefan Roth, and I am a Cloud and Datacenter MVP. In a couple of posts, I would like to show you how cool it is that Microsoft is touching the Linux world. Myself, I am a 100% Microsoft fan, but, as you can read all over the Internet…Microsoft loves Linux. This is not just a one-night stand. Microsoft is really serious about Linux support in all cloud scenarios (private, public, and hybrid). Therefore, we start with something really cool.

I will start a three-part series that touches a few parts of the Linux direction that Microsoft is taking. My first post gives you an overview of Bash on Windows 10 by using Secure Shell (SSH). We’ll run a script that installs the prerequisites and sets up a desired state configuration (DSC) environment. The second post will show you how to install .NET Core and PowerShell on Linux by using DSC. The last part will use Azure Automation DSC and the Operations Management Suite injection API for some fun.

The anniversary update

Microsoft released the Windows 10 Anniversary Update on August 2nd. One awesome new feature is the Windows Subsystem for Linux (WSL) that runs on top of Windows 10. What does that mean? This subsystem allows you to run native Linux binaries on Windows. If you remember back to Windows NT, there was already a POSIX subsystem available for Unix-based applications. Because the Windows NT kernel was designed to run such subsystems, Microsoft could use this architecture and build a subsystem for Linux. Exactly how this works is explained in the Windows Subsystem for Linux Overview blog post.

Diagram of the Windows Subsystem for Linux

Why should we care at all? Good question. I think there is a short-term goal and a long-term goal. If you watched Technical Fellow Jeffrey Snover announcing PowerShell on Linux and Open Sourced , Jeffrey mentioned a vision to manage any system from any operating system by using Windows PowerShell. One short-term goal is for developers to have a Linux environment available on Windows as also a “native” way to use SSH to connect and manage native Linux systems, which has been requested for years. Scott Hanselmann has released a nice video on his blog, which shows what you can do with Bash and explains some more details.

Install Bash on Windows

First, let’s install Bash on Windows 10. Make sure that you have the latest Windows 10 Anniversary 64-bit edition and that you have Developer Mode enabled. Open the Settings app and go to Update & security > For developers. Select Developer mode to enable Developer Mode.

The "Developer mode" option in "Settings"

Next, use Turn Windows features on or off to turn on Windows Subsystem for Linux (Beta), reboot, and everything is done.

Selection of "Windows Subsystem for Linux (Beta)" in the "Turn Windows features on or off to turn on" dialog box

Type Bash in the Run Window, and follow the instructions to complete the setup. Now you are a proud owner of an Ubuntu Bash on Windows 10 that’s waiting for input.

I have a CentOS 7 x64 Linux system called centos installed on my local Hyper-V server. Now let’s connect from your Windows 10 Bash to the CentOS server system by using SSH.

Type within Bash:

ssh [IP OF YOUR SERVER] -l root

Enter your password when prompted.

Using SSH to connect to your server

Note: If you receive a response like this, just confirm by typing yes.

The authenticity of host ‘192.168.32.18 (192.168.32.18)’ can’t be established. ECDSA key fingerprint is 26:b6:fb:b1:de:76:b0:2e:47:68:0b:94:32:00:c9:08. Are you sure you want to continue connecting (yes/no)?

Now you are authenticated as root (root = administrator permission) to the remote system via SSH. If you get an error, check on your Linux server locally to determine if the sshd (SSH daemon) is running by typing:

service sshd status

You should get an output as shown in the following screenshot.

Result of "service sshd status" command

Install the prerequisites

Next, we are going to run a little shell script to download all prerequisites and source for the OMI CIM server and the DSC packages. After successful download, we’ll install the rpm packages (Package Manager for Red Hat).

First, to create the script file, go to /root/Downloads:

  1. Type vi install.sh to launch an empty file called install.sh.
  2. Type i to insert text.
  3. Paste the script that follows these steps.
  4. Type Esc key to change vi editor mode.
  5. Type :.
  6. Type wq! to write and quit.

It should look like this…

Screenshot of pasted script

Shell script:

#####################################################################################

#! /bin/sh
# Get prerequisites for OMI CIM server and DSC
# Install the Development Tools
# Get groups by running => yum groupinstall
yum -y groupinstall 'Development Tools'

# Install python and header files
yum -y install python
yum -y install python-devel

# Install authentication modules
yum -y install pam-devel

# Install openssl
yum -y install openssl-devel

# Change to the Downloads directory
cd /root/Downloads

# Download the OMI CIM server package
wget https://github.com/Microsoft/omi/releases/download/v1.1.0-0/omi-1.1.0.ssl_100.x64.rpm

# Download the DSC for Linux package
wget https://github.com/Microsoft/PowerShell-DSC-for-Linux/releases/download/v1.1.1-294/dsc-1.1.1-294.ssl_100.x64.rpm

# Run rpm package manager for the OMI CIM server package
sudo rpm -Uvh omi-1.1.0.ssl_100.x64.rpm

# Run rpm package manager for the DSC package
sudo rpm -Uvh dsc-1.1.1-294.ssl_100.x64.rpm

###############################################################################

Next, to set the permission to the script as executable, type:

chmod +x install.sh

Result of "chmod +x install.sh"

Finally, execute the script. The install process will kick off, and you will see the installation.

Result of installation

Note: If you get an error like “…Another app is currently holding the yum lock”, the yum installer is running in the background. To temporarily prevent the database lock, use the following command to stop the daemon.

Stop yum installer

service packagekit stop

Run the script again ./install.sh. If everything worked, you should have a prompt again and run the next command to see the status of the OMI CIM server.

OMI CIM server status

service omid status

Result of the "service omid status" command

At this point, OMI CIM server and DSC Linux components are installed – up and running.

Testing it

If you want to explore your installation, there are few commands which might help you to troubleshoot OMI CIM server and DSC.

OMI Server

Show OMI server version:

/opt/omi/bin/omiserver -v

Show OMI server help:

/opt/omi/bin/omiserver -h

Shows the OMI server configuration file

vi /etc/opt/omi/conf/omiserver.conf

Shows the OMI server log file

vi /var/opt/omi/log/omiserver.log

DSC

Get DSC configuration

/opt/microsoft/dsc/Scripts/GetDscConfiguration.py

Get LCM configuration

/opt/microsoft/dsc/Scripts/GetDscLocalConfigurationManager.py

Install a DSC custom module

/opt/microsoft/dsc/Scripts/InstallModule.py /tmp/cnx_Resource.zip

Remove a DSC custom module

/opt/microsoft/dsc/Scripts/RemoveModule.py cnx_Resource

Applies a configuration MOF file to the computer

/opt/microsoft/dsc/Scripts/StartDscLocalConfigurationManager.py –configurationmof /tmp/localhost.mof

Applies a Meta Configuration MOF file to the compute

/opt/microsoft/dsc/Scripts/SetDscLocalConfigurationManager.py –configurationmof /tmp/localhost.meta.mof

Shows the DSC log file

vi /var/opt/omi/log/dsc.log

Summary

First, we installed the Windows Subsystem for Linux and used Bash to make a connection to a Linux server by using SSH. From this shell, we ran an installation script to install OMI CIM Server and DSC for Linux.

You might have noticed that we never had to leave the Bash window. We could manage the Linux server from Windows 10 without logging in to the Linux server console. One small but important goodie I like is that we are also able to copy from Windows and paste to the Bash window as we did tocreate the shell script file.

Thank you, Stefan.

I invite you to follow me on Twitter and Facebook. If you have any questions, send email to me at scripter@microsoft.com, or post your questions on the Official Scripting Guys Forum. Also check out my Microsoft Operations Management Suite Blog. Until then, peace.

Ed Wilson, Microsoft Scripting Guy

Author

The «Scripting Guys» is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

Last Updated :
12 Apr, 2025

Did you know you can use Linux right inside your Windows 10 computer—without needing a separate Linux setup? Thanks to a feature called Windows Subsystem for Linux (WSL), you can now open a Bash shell, run Linux commands, and manage your projects easily.

This guide will help you set up and use the Bash shell on Windows 10, making it simple to explore Linux tools and commands while still using your Windows system. It’s the best of both worlds.

Steps to Install & use Bash Shell Natively on Windows 10

Microsoft, therefore, in their Anniversary Update, added several features to the Windows 10 OS, with bash being one of them. To install and use it on Windows 10, one needs to perform the following steps :

  • Start -> Settings -> Update&Security. Under the ‘Use Developer Features’, select ‘Developer mode’.

  • Selecting the developer mode will pop the following alert. Click yes, and let the computer restart.

  • Go to Control Panel -> Programs and Features -> Turn Windows Features On and Off. In the window that appears, check the ‘Windows Subsystem for Linux’ option, and click OK.

  • This will trigger an alert asking for the system to be restarted to complete the installation of the required components. After the restart is complete, go to the command prompt, and type ‘bash’. Follow the instructions that appear to install bash from Windows store. After it is installed, it will be required to create a UNIX username. After completing the installation, exit the prompt.
  • To access the shell, simply type ‘bash’ in the Windows command prompt, and everything is good to go.

Note that bash runs natively on Windows 10, which is different from using emulators like ‘cygwin’ for Windows which enabled GNU tools to run on unsupported Windows environment. Also, Linux subsystem for Windows 10 is only available on the 64-bit version of the OS.

Conclusion

By following these steps, you can easily set up and use the Bash shell natively on Windows 10 through the Windows Subsystem for Linux (WSL). This integration allows you to run Linux commands, scripts, and tools directly on your Windows machine, making it a versatile and convenient solution for developers and power users alike. Whether you’re looking to leverage Linux utilities or streamline your development workflow, using Bash on Windows 10 opens up a world of possibilities without leaving the Windows environment.

Did you know that Windows 11, Microsoft’s latest operating system, comes with built-in support for running Linux commands? It’s a feature that’s more accessible than ever before.

You might be wondering why you’d want to use Linux commands on your Windows machine. Well, Linux is known for its powerful tools and flexibility. It’s particularly useful for developers, but it can be helpful for anyone who wants to do more with their computer.

In the past, using Linux on a Windows PC was complicated. You had to set up a separate system or use tricky workarounds. But now, Windows 11 has made it much simpler. You can add something called “Bash” to your computer, which lets you use Linux commands right alongside your regular Windows programs.

In this article, you’ll learn how to set up Bash on your Windows 11 PC. Don’t worry if you’re not very tech-savvy – we’ll guide you through each step in simple terms. By the end, you’ll be ready to explore the world of Linux commands right from your familiar Windows environment.

Whether you’re looking to enhance your computing skills or just curious about what Linux can do, this guide has got you covered.

How to set up Bash on Windows 11

Windows 11 makes it easier than ever to use Linux commands on your PC. Here’s how you can set it up:

Check your system requirements

Before you start, make sure your Windows 11 PC is up to date. You don’t need to worry about turning on Developer Mode or enabling Windows Subsystem for Linux manually – Windows 11 takes care of this for you.

Install a Linux distribution

  • Open the Microsoft Store on your Windows 11 PC.

tap on the microsoft store pc

  • Search for “Linux” in the store.

search the linux window

  • Choose a Linux distribution you like, such as Ubuntu, Debian, or Fedora.
  • Click “Install” and wait for it to download.

click on get button ubuntu

Set up your Linux distribution

  • Once installed, click “Open” to launch your chosen Linux distribution.

open the ubunut app window

  • The first time you run it, you’ll need to set up a username and password. This doesn’t have to be the same as your Windows login.
  • After setup, you’ll see a terminal window where you can start using Linux commands.

you'll need to set up a username and password

Access Bash anytime

To use Bash in the future, you have a few options:

  • Click the Start menu and look for your installed Linux distribution.
  • Open Windows Terminal and select your Linux distribution from the dropdown menu.
  • In the Start menu search bar, type “wsl” and press Enter to open the default Linux distribution.

That’s it! You now have Bash set up on your Windows 11 PC. You can use Linux commands and tools right alongside your regular Windows programs. Whether you’re a developer or just curious about Linux, you’re now ready to explore this powerful tool.

The takeaway

Setting up Bash on Windows 11 is easier than you might think. You don’t need to be a tech expert to bring Linux commands to your PC. With just a few simple steps, you can add a powerful new tool to your computer.

The process is straightforward: update your Windows 11, install a Linux distribution from the Microsoft Store, and set up your new Linux environment. After that, you can access Bash whenever you need it through the Start menu or Windows Terminal. It’s like having two operating systems in one!

Some people think using Linux commands on Windows is only for programmers or advanced users. That’s not true. Anyone can benefit from learning a few Linux commands, whether you’re managing files, automating tasks, or just exploring new ways to use your computer.

The most important thing to remember is that you now have more options at your fingertips. Don’t be afraid to experiment with your new Bash setup. The more you use it, the more comfortable you’ll become. Who knows? You might discover new ways to make your computer work better for you.

We’d love to hear about your experience setting up Bash on Windows 11. Share your thoughts or questions in a comment below!

Frequently Asked Questions

What are the system requirements for installing Bash on Windows 10?

Your PC must be running a 64-bit version of Windows 10 with a version number no lower than 14393. Ensure your system is updated to the latest version to meet these requirements.

How do I enable Windows Developer Mode?

Right-click the Start menu, select Settings, go to Update & Security, click on For developers, and then select Developer mode. Confirm your selection to enable Developer Mode.

What is the Windows Subsystem for Linux and how do I enable it?

The Windows Subsystem for Linux (WSL) allows you to run a Linux environment directly on Windows. To enable it, search for Windows Features in the search bar, select Turn Windows Features On or Off, check the box next to Windows Subsystem for Linux, and click OK.

How do I install a Linux distribution on Windows 10?

Go to the Microsoft Store, choose your preferred Linux distribution (like Ubuntu), click install, and then launch it after the installation completes.

How do I access Bash after installing a Linux distribution?

After installation and setting up your Linux distribution, close the window, right-click the Start menu, choose Windows PowerShell (Admin), enter your administrator password if prompted, type bash in the PowerShell window, and press Enter.

Can I use Linux commands for Windows file management with Bash?

Yes, once you have Bash and your Linux distribution set up, you can use Linux commands to interact with the Windows file system. This allows for seamless operations across both platforms.

Понравилась статья? Поделить с друзьями:
0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии
  • Gpx viewer for windows
  • Таймер выключения компьютера windows 10 прога
  • Сервер пересылки dns windows server 2012
  • Не получается восстановиться из образа системы созданным встроенным средством архивации windows 7
  • All in one windows installer