A file with .sh file extension can be called .sh file that can be run in the Linux-based operating system and also in Windows operating systems. Well, this post from MiniTool Partition Wizard shows you how to run .sh file in Linux and Windows 10/11.
A .sh file is like the batch file of Windows operating system. You can run it in Linux and also in Windows. (You might be interested in Linux vs Windows – What Are the Differences (Focus on 10 Aspects))
Well, how to run .sh file in Linux and Windows? A detailed tutorial is displayed below.
How to Run .sh File in Linux?
After creating a .sh file, you can run it in Linux. First, run this command chmod +x minitool.sh to set up executable permission on your .sh file. Then, run the command sh minitool.sh to run your .sh file.
If you need root access to install an application or make system level modifications with your .sh file, then you need to run this file as a root user. For that, run the command sudo bash minitool.sh; then type your user password and hit the Enter key.
How to Run .sh File in Windows?
You can run .sh file in Windows in a couple of ways:
- Run .sh file using WSL
- Run .sg file using Ubuntu
Run .sh File Using WSL
WSL is the abbreviation of Windows Subsystem for Linux. As its name replies, you can use it to run the native Linux command-line directly on Windows operating system.
Well, how to run .sh file in Windows with WSL? Here are the steps:
Step 1: Install WSL on your Windows computer.
Go to Settings > Update & Security > For developers. Then, tick the Developer mode option. Next, search for Windows Features and select the Turn Windows features on and off option. Finally, find WSL and check the box to install it.
Step 2: Restart your computer to finish the WSL installation.
Once your computer restarts, BASH will be available in the Command Prompt and PowerShell.
Step 3: Run your .sh file in Command Prompt.
First, open Command Prompt. Then, run the cd xxx command (xxx stands for the name of the folder where your file is located; for example, the command could be “cd desktop”). Next, type the bash minitool.sh command on the Command Prompt window and hit the Enter key.
Run .sh File Using Ubuntu
In Windows, alternatively, you can run your .sh file using Ubuntu. In this way, you can your .sh file in a Linux environment on Windows.
Well, how to run .sh file in Windows using Ubuntu? Here are the steps:
Step 1: Install Ubuntu or Windows Subsystem for Linux (Beta).
The installation process is like the above installation of WSL. But the difference is that you should find Windows Subsystem for Linux (Beta), check the box, and click OK to install Ubuntu.
Step 2: Restart your computer to finish the installation.
Step 3: Run your .sh file in Command Prompt.
First, open Command Prompt. Then, type bash and hit the Enter key to launch the distro prompt. Next, run the cd xxx command to navigate to the folder where the .sh file is located. Finally, type the sh minitool.sh command and hit the Enter key.
That’s all about how to run .sh file in Linux and Windows. Hope this post is useful for you.