Main Tutorials

Linux – How to assign execute permission to a .sh file

On *nix, you can use chmod +x file.sh to make a .sh file executable.

Terminal

$ ls -lsah
total 12K
4.0K drwxr-xr-x  2 mkyong mkyong 4.0K Feb   5 10:24 .
4.0K drwxr-xr-x 17 mkyong mkyong 4.0K Feb   5 10:24 ..
4.0K -rw-r--r--  1 mkyong mkyong   67 Feb   5 10:24 run-script.sh

$ chmod +x run-script.sh 

$ ls -lsah
total 12K
4.0K drwxr-xr-x  2 mkyong mkyong 4.0K Feb   5 10:24 .
4.0K drwxr-xr-x 17 mkyong mkyong 4.0K Feb   5 10:24 ..
4.0K -rwxr-xr-x  1 mkyong mkyong   67 Feb   5 10:24 run-script.sh

Above example, assign an execute permission +x to run-script.sh

References

  1. Wikipedia – chmod

About Author

author image
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter. If you like my tutorials, consider make a donation to these charities.

Comments

Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments