When I double-click on a script in Nautilus to run it, the script just opens in my text editor with no option to run it. Using Nautilus, how do I run executable text files and/or scripts?
-
6The default behavior is a bug. Users should not have to fiddle with settings to make this work. I've filed https://bugs.launchpad.net/ubuntu/+source/nautilus/+bug/1433774. – Mar 18 '15 at 20:09
-
Possible duplicate of [How to execute a script just by double clicking like .EXE files in Windows?](http://askubuntu.com/questions/138908/how-to-execute-a-script-just-by-double-clicking-like-exe-files-in-windows) – Stefan Monov Dec 09 '16 at 15:50
-
2@StefanMonov if anything, the dupe should be the other way. – TheWanderer Dec 10 '16 at 21:55
11 Answers
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
- 167
- 1
- 7
- 70,934
- 124
- 466
- 653
-
30What a weird default to have. And not even a right-click option to just run the file. Very unfriendly to users. – RomanSt Sep 11 '14 at 22:59
-
-
4On step #2, "Open this from the menu bar"... where is the menu bar? I don't see an "Edit" menu anywhere. I see my files in the middle, several local and network locations on the left, and a menu button in the top right which just has buttons such as "new tab" and undo/redo. The top just has the back/forward buttons and the list of folders I'm in. – Aaron Franke Jun 03 '16 at 00:44
-
@AaronFranke: In ubuntu the menu bar shows when you hover the dark bar on the top of the screen. – Stefan Monov Dec 09 '16 at 14:25
-
1@StefanMonov I'm using Xubuntu, not Ubuntu, and so I don't have a dark bar at the top of the screen. – Aaron Franke Dec 10 '16 at 09:23
-
I was also able to use this answer for the similar "Files" app, whatever is is called underneath, in my Fedora installation! – Pysis Jan 07 '17 at 16:50
-
@Pysis The "Files" in Fedora is exactly Nautilus. Try `nautilus` in terminal. – Franklin Yu Oct 10 '17 at 14:51
-
@AaronFranke Hamburger menu > preferences... then behavior tab, sorry for the 3 year+ delay – SparK Jan 14 '20 at 18:38
-
@AaronFranke: that's another oddity in GNOME: placing important menu items in the window title bar, unlike all other desktop environments. The title bar is for open/close/minimize buttons, and users just don't look there for other stuff, like [search](https://bugs.launchpad.net/ubuntu/+source/gnome-software/+bug/1878301). – Dan Dascalescu May 27 '20 at 20:29
Follow these steps:
- Install
dconf-editorbecause it isn't installed by default. - Hit Alt+F2, type
dconf-editorand hit Enter. In
dconfg-editorgoto:org➤gnome➤nautilus➤preferences
Click on
executable-text-activationand 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!
- 14,308
- 4
- 74
- 117
- 23,936
- 8
- 61
- 82
-
7You can also open nautilus, click Files > Preferences, check behaviour tab, and select the option you prefer for Executable Text Files, open with text editor is the default. – Nur Apr 27 '13 at 14:03
-
Although this works too, dconfg-editor is the worst possible way of changing application configuration. – Benjamin May 05 '14 at 18:15
-
This answer was very helpful for me, even though using the preferences dialog would "normally" be a better answer, as I'm using a tiling window manager and the "Files" menu appears to be completely inaccessible! – Ben Apr 27 '15 at 01:17
-
In Ubuntu 22.04, the `executable-text-activation` key doesn't exist. – Roman Grinyov Dec 16 '22 at 12:13
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.
- 10,912
- 7
- 48
- 61
in a terminal
gsettings set org.gnome.nautilus.preferences executable-text-activation ask
- 261
- 3
- 8
-
+1: This works in older versions of Linux, even before the dconf method became available. – Alex Mar 31 '17 at 16:17
-
2
-
Is there a way to apply this same configuration for all users? (Either for all existing users, or for all users created in the future, or both?) – Wildcard Oct 12 '18 at 10:28
-
I believe yes. im not sure how to do it. maybe you can update it in /etc/profile or /etc/bash.bashrc – OmaL Oct 12 '18 at 10:48
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.
- 14,308
- 4
- 74
- 117
- 27,676
- 16
- 81
- 117
-
1@DKBose: The command 'dconf' is in Ubuntu by default. dconf-editor only provides the GUI program to edit dconf. – kiri Feb 23 '14 at 08:43
-
For that I guess the best way will be to make .desktop launcher, make that launcher executable using
chmod +x blah.desktop
And after that you will be ready to run it via just clicking, and even more you can add it to launcher. To read more about how to make .desktop files look here. Main part of it is this
[Desktop Entry] Type=Application Terminal=false Icon=/path/to/icon/icon.svg Name=give-name-here Exec=/path/to/file/executable
-
Opening the associated script editor instead of launching the script is already a problem for executable `.desktop` files as seen in [this bug](https://bugs.launchpad.net/ubuntu/+source/nautilus/+bug/1433774), so this answer doesn't help. – Dan Dascalescu May 27 '20 at 20:05
You can do this for a single file by going into permissions in file properties and selecting "run this file as an executable".

- 35,092
- 41
- 129
- 192
- 203
- 2
- 8
You can use the most upvoted answer in Fedora 20 + GNOME too:
Open Nautilus, check Preferences -> Behavior -> Executable Files, put as always ask
- 353
- 1
- 2
- 10
You have to check 3 points :
- Nautilus / Nemo configuration : https://askubuntu.com/a/286651/301025
- The script file must have executable permission : https://askubuntu.com/a/275714/301025
- The file system must allow execution :
- Type "mount" in a console
- Check if your file system has noexec flag
- Remove noexec flag in editing /etc/fstab and
right click on the file -> open with -> other application -> view all applications -> run software -> select
from now on shell scripts will be run on double click.
- 765
- 5
- 16
Open Nautilus. (File Browser)
In Ubuntu 17.04, now we can cummulative bar so Preferences in available in Files.
Open this from the menu bar:
Files → Preferences
Select 'Behavior' tab
Select "Ask what to do" under "Executable Text Files".

Close it.
- 193,181
- 53
- 473
- 722
