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
1 Answers
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 cd
ing 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

- 19,395
- 12
- 50
- 65
.sh
file with GEdit (text editor) by default with Ubuntu. You should try running the command from the Terminal. – armadadrive Sep 10 '15 at 01:04#!/bin/sh
on the first line? – dobey Sep 10 '15 at 01:55