How to run Shell Script .sh file


.sh files are shell scripting files. We can run these files in terminal on a linux system.

Navigate to file location

Start terminal and navigate to folder where you have the shell script .sh file. If this is a server / vps, login to your server using putty.

Let’s suppose my shell script file name is and it is located in /root directory. Use below command to navigate to /root directory.

cd /root

Run the script file

Use the below command to run or execute the script.




Permission denied error message

If we try to run this script using below command, we will get Permission denied error message.


We first need to set execute permission to the script file and then run the script.

chmod +x

Our Top Rated Host

Related Posts