How to run shell script in Linux

A shell script is a text file that contains shell commands, and can be executed on a Linux system. Here are the steps to run a shell script in Linux:

  1. Make the script executable:
chmod +x script.sh

Replace “script.sh” with the actual name of your shell script file. This step sets the execute permission on the script file, which is required to run the script.

  1. Run the script:
./script.sh

Replace “script.sh” with the actual name of your shell script file. This step executes the script and performs the actions specified in the script file.

It’s important to note that the shell used to run the script must be installed on your system and the first line of the script should specify.

Leave a Comment