Ubuntu – How to change how executable files are handled by the file manager

executablefilesfilesystemnautilus

When I double click on text files, nautilus asks me what I would like to do with them. I find this to be intrusive, as I just want them to open.

How can I fix this?

Note:
This question is a "canonical" question on the subject; edit if needed.
Note 2: Text files can be HTML, CSS, TXT, and more.

Best Answer

Go to Edit>Preferences>Behavior in Nautilus, and change this option:

Nautilus

What these options mean:

"Run executable text files when they are opened"
This option will execute (run) text files as if they are programs (or scripts), but note that if the files are not scripts or have errors, you won't see a thing.

Note: This option is very risky, because it could allow you to run dangerous scripts accidentally.

"View executable text files when they are opened"
This option will provide the most comfortable behaviour, if you just need to view your text files (HTML, CSS, txt, etc). When you need to run actual scripts, you can right click them and choose to run them from the context menu, or use a terminal.

"Ask each time"
This option provides a safe balance between the two other options, allowing you to choose each time you double click on a text file, and providing a prompt that should help to avoid running risky files accidentally.

Related Question