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?


12 Answers 12

  1. Open Nautilus.

  2. Open this from the menu bar:

    Edit → Preferences

  3. Select the 'Behavior' tab.

  4. Select "Ask each time" under "Executable Text Files".

  5. Close the window.
  6. Right click the file, and select "Properties.
  7. Select the "Permissions" tab, and make sure "Allow executing file as program" is selected.

  8. Close the window.

Now you can double-click your executable text file in Nautilus to be asked whether to execute or edit your script.

enter image description here

Answer credit: Nur

  • 30
    What a weird default to have. And not even a right-click option to just run the file. Very unfriendly to users.
    – RomanSt
    Sep 11, 2014 at 22:59
  • What about I want it to always run in terminal? May 5, 2015 at 17:08
  • 4
    On 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. Jun 3, 2016 at 0:44
  • @AaronFranke: In ubuntu the menu bar shows when you hover the dark bar on the top of the screen. Dec 9, 2016 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. Dec 10, 2016 at 9:23

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: orggnomenautiluspreferences

    enter image description here

  • Click on executable-text-activation and from drop down menu select:

    launch: to launch scripts as programs.


    ask: to ask what to do via a dialog.

  • Close dconf-editor. That's it!

  • 7
    You 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, 2013 at 14:03
  • Although this works too, dconfg-editor is the worst possible way of changing application configuration.
    – Benjamin
    May 5, 2014 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, 2015 at 1:17
  • 3
    In Ubuntu 22.04, the executable-text-activation key doesn't exist. Dec 16, 2022 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;

  1. install (if you haven't already) and start dconf Editor,
  2. go to: org > gnome > nautilus > preferences, and
  3. 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
  • +1: This works in older versions of Linux, even before the dconf method became available.
    – Alex
    Mar 31, 2017 at 16:17
  • 2
    This should be the accepted answer, IMHO.
    – tao
    Jan 29, 2018 at 1:22
  • 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, 2018 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, 2018 at 10:48

Using GUI

  1. 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

  2. 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.

  • 1
    @DKBose: The command 'dconf' is in Ubuntu by default. dconf-editor only provides the GUI program to edit dconf.
    – kiri
    Feb 23, 2014 at 8:43
  • You are correct. Sorry about that!
    – DK Bose
    Feb 23, 2014 at 11:04

You can do this for a single file by going into permissions in file properties and selecting "run this file as an executable".

enter image description here


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]
  • Opening the associated script editor instead of launching the script is already a problem for executable .desktop files as seen in this bug, so this answer doesn't help. May 27, 2020 at 20:05

You can use the most upvoted answer in Fedora 20 + GNOME too:

Open Nautilus, check Preferences -> Behavior -> Executable Files, put as always ask

You have to check 3 points :


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.

  • except they won't. don't even appear in htop, nothing.
    – clockw0rk
    Oct 5, 2023 at 19:06

In Nautilus 45.0+, try this steps

  1. Create desktop file at ~/.local/share/applications
[Desktop Entry]
Exec=bash %f
Terminal=true or false
  1. Create bash script file and make it executable
# with or without shebang line

# write commands
  1. In Nautilus, right-click the script file, click "Open with", select the created desktop entry name in the list, and check "Always use for this file type".

  2. You can then run the script file by double-clicking it in Nautilus.

To target specific file extension, for example *.ext1, try this steps also.

  1. Create XML file for MIME type definition in
<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
        <mime-type type="my-custom-mime-types/custom-ext1-mime-type">
                <comment>My Custom EXT1 MIME Type</comment>
                <glob pattern="*.ext1"/>
  1. Update MIME database using one of following command
update-mime-database ~/.local/share/mime
sudo update-mime-database /usr/share/mime
  1. Result file is as follows

Additional MIME types can be added to the my-custom-mime-types.xml file, then run the 'update-mime-database' again. For more details, see https://blog.robertelder.org/custom-mime-type-ubuntu/

  1. Open Nautilus. (File Browser)

    1. In Ubuntu 17.04, now we can cummulative bar so Preferences in available in Files.

    2. Open this from the menu bar:

  2. Files → Preferences

  3. Select 'Behavior' tab

  4. Select "Ask what to do" under "Executable Text Files".


  5. Close it.

  • 1
    duplicate answer
    – wisbucky
    Aug 9, 2017 at 18:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .