When using Windows, bash is a powerful tool to access Linux/UNIX commands and operations on Windows systems. You don’t have to install a virtual setup to run dual operating systems. Install WSL on Windows 11 and perform Linux commands and shell scripts within it.
- How to Install & Use Linux Bash Shell on Windows 11
- How to Launch Linux Distribution on Windows 11
- How to Run Bash Shell on Windows 11
- How to Create a Bash Script File in Windows 11
- How to Run Bash Script file in Windows 11
To access the bash shell on Windows 11, install WSL on the system. The process is quite simple & interesting, so there’s no need to worry.
Launch Windows Terminal by right-clicking on the Windows icon and selecting Terminal (Admin). This will run the terminal application as administrator:
After getting the terminal on screen, type in the following command to execute it and hit Enter:
The system will begin downloading and installing the relevant assets; this process may take several minutes.
After the wsl installation, the installation process will continue to start downloading Ubuntu automatically and ask you to restart the system once it’s done:
Next, the terminal will ask you to set credentials for the Linux default distro, Ubuntu. Ensure that you do not set the same Windows login Credentials; this should be different:
Once the process is completed, Ubuntu will be launched.
You’re not limited to Ubuntu distribution only. Other distributions can also be installed on Windows 11; just what distributions are available.
To see the list of available distributions, run the following command in Windows Terminal:
You can easily install any other Linux distro on Windows Terminal by referring to the list available and using the command given below:
Replace the destro_name with the name of the Linux distribution that you want to install:
The process is the same as we did in the Ubuntu installation; you need to add credentials that differ from Windows login credentials.
You have two options to launch the downloaded Linux distribution:
Open the Windows Terminal through the Start menu and type the ubuntu command:
Alternatively, you can directly search it from the Windows Search bar by typing Ubuntu in it; select the Ubuntu app to launch it:
Let’s run bash commands to check how it works to launch Linux Bash Shell on Windows 11.
To display the list of all Linux commands that can be used in Bash Shell, execute the following command in the terminal:
Run the help command with the parameter in Linux Bash Shell to get the individual command details:
To create a bash file, the following process should be followed:
Step 1: Open a text editor like Nano or any other tool to create a file:
Step 2: Start writing the script:
echo “Hello World”
Save the file with the .sh extension by pressing the Control +X key and setting the file’s name like mybash.sh.
Step 3: Open the Linux terminal and type the ls command to check if the file has been successfully created:
To run bash scripting, launch the command prompt on the screen and enable Linux distro by typing ubuntu in it.
Type the file name in the terminal and hit the Enter button:
Linux Bash Shell is the default command-line tool and a replacement for Bourne Shell. It is a powerful tool to run Unix operations on Windows without installing a virtual setup. Bash shell supports user-friendly commands; not only this, but you can also execute Unix tasks and manipulate files within it. To get it on Windows 11, we must install WSL first on Windows 11, and it will automatically download Ubuntu as the default distro of Linux. This article mentioned a detailed guideline for installing WSL on Windows 11 and how to launch it. Moreover, we have learned how to run a bash script file on Windows 11.