This question already has an answer here:

I right click and into properties I allow the permision to run as a programe. But still cannot run it. It is still opening in text document file

marked as duplicate by muru, A.B., Pilot6, David Foerster, Eric Carvalho Sep 15 '15 at 14:22

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Are you trying to run this program from within the Files manager? Double clicking will open a .sh file with GEdit (text editor) by default with Ubuntu. You should try running the command from the Terminal. – armadadrive Sep 10 '15 at 1:04
  • Can you maybe attach a screenshot of the file properties dialog showing the permissions of the file, in your question? Also, does the file start with #!/bin/sh on the first line? – dobey Sep 10 '15 at 1:55
  • The file starts with #!/bin/sh i check the permission on the properties. – Andrew Twirling Sep 10 '15 at 12:06
  • Is your goal simply to run the script at all, or to have some way to launch the script from within the file manager, or on the launcher as well? Please clarify your question, so that a proper answer can be provided. – dobey Sep 10 '15 at 14:46
  • In the instruction the app that i downloaded.. it said "run" the install.sh and it will automatically be installed. But it opened in text document.. – Andrew Twirling Sep 12 '15 at 15:09

Double clicking an sh file won't execute it because sh files are really just text files containing terminal commands. It's always kind of annoyed me that certain files aren't able to be executed by double clicking them, but that's just the way Linux works. If you want to run the sh file, you need to use the terminal.

Press ctrl + alt + T to open a terminal. Now there are two ways to execute an sh script from the terminal. One is done by cding to the parent directory and then running it from there, while the other way just points directly to the file. I'll show both of them below.

For these examples I'm using my own user name and path I made up. You have to specify the actual path to your sh file.

By using cd

cd /home/zacharee/Downloads/program/
sudo ./program.sh

By just putting in the full path:

sudo /home/zacharee/Downloads/program/program.sh

Either way will work fine.

Now, if you really want to be able to double click executable scripts from your file browser to run them, you can try this:

Open Nautilus (the file browser) and open the File... menu. From here, select Preferences and go to the Behavior tab. There should be a dropdown menu option named something like Executable Text Files:. In the dropdown, select the Run ... option and apply these settings.

Source: Not executing programs (*.sh ) with double click in 13.04

Not the answer you're looking for? Browse other questions tagged or ask your own question.