How do I run executable scripts in Nautilus rather than open them in Gedit text editor? [duplicate]
Open Nautilus.
-
Open this from the menu bar:
Edit → Preferences
Select the 'Behavior' tab.
Select "Ask each time" under "Executable Text Files".
- Close the window.
- Right click the file, and select "Properties.
Select the "Permissions" tab, and make sure "Allow executing file as program" is selected.
Close the window.
Now you can double-click your executable text file in Nautilus to be asked whether to execute or edit your script.
Answer credit: Nur
Follow these steps:
- Install
dconf-editor
because it isn't installed by default. - Hit Alt+F2, type
dconf-editor
and hit Enter. -
In
dconfg-editor
goto:org
➤gnome
➤nautilus
➤preferences
-
Click on
executable-text-activation
and from drop down menu select:launch: to launch scripts as programs.
OR
ask: to ask what to do via a dialog.
Close
dconf-editor
. That's it!
I think this is a nuisance caused by Gnome people who decided to change that default behavior we were accustomed to.
To fix it, you can;
- install (if you haven't already) and start dconf Editor,
- go to: org > gnome > nautilus > preferences, and
- change the value for executable-text-activation back to ask (or even launch, if you prefer).
If you want the same Nautilus behavior as Root as well you can repeat the steps above, starting dconf Editor this time as Root.
in a terminal
gsettings set org.gnome.nautilus.preferences executable-text-activation ask
Using GUI
-
Depending on which Ubuntu version you have,
-
14.04 or 16.04
In Nautilus, open this from the menu bar:
Edit → Preferences
-
18.04+
In Nautilus, open this from the menu bar:
Files → Preferences
-
-
Then, in the 'Behavior' tab, select "Run them" (previously "Run executable text files with they are opened").
Alternatively, select "Ask each time" instead if you would like a dialog (example) asking you whether to edit or execute the file.
Using Command line
If you prefer a command:
dconf write /org/gnome/nautilus/preferences/executable-text-activation "'launch'"
Note: Both GUI and command line methods work only for Nautilus (the default graphical file manager in Ubuntu).
Originally from another answer posted by me here.