How To Run the .sh File Shell Script In Linux / UNIX

Ihave downloaded software for my Linux or Unix-like system from the Internet. There is a file called How do I run an .sh file to install the software? How do your run .sh files from command line?

You can open or run .sh file in the terminal on Linux or Unix-like system. The .sh file is nothing but the shell script to install given application or to perform other tasks under Linux and UNIX like operating systems.The easiest way to run .sh shell script in Linux or UNIX is to type the following commands. Open the terminal (your shell prompt) and type the command.

How do I run .sh files in Linux?

The procedure to run the .sh file shell script on Linux is as follows:

  1. Set execute permission on your script:
    chmod +x
  2. To run your script, enter:

Let us see examples and usage in details.


The syntax is:

How to run .sh file as root user

Some time you need root access to install application; without root, you won’t have the necessary permissions to install application or make system level modifications. Root access is disabled by default on many Linux and UNIX like systems. Simply use the sudo or su command as follows:
sudo bash
Type your password. Another option is to use the su command as follows to become superuser:
su -
Type root user password and finally run your script:

How to use chmod command to run .sh shell script in Linux

Another recommend option is to set an executable permission using the chmod command as follows:
chmod +x
Now your can run your .sh file as follows

How do I run .sh file named

Just run the following two command:
chmod +x

The dot (.) refers to the current working directory. The is in the current directory so you run it as above or as follows too:

GUI method to run .sh file

  1. Select the file using mouse.
  2. Right-click on the file.
  3. Choose Properties:
  4. Click Permissions tab.
  5. Select Allow executing file as a program:
  6. Now click the file name and you will be prompted. Select “Run in the terminal” and it will get executed in the terminal.

See also:

Posted by: SXI ADMIN

The author is the creator of SXI LLC and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

Leave a Reply

Your email address will not be published. Required fields are marked *

Previous Post

How to Make Website WCAG Compliant?

Next Post

Link download Kali Linux 2020.1 (ISO + Torrent)

Related Posts