open with list

I have tried uninstalling and reinstalling gnome-terminal and installing Konsole, neither appear as an option to open programs with.

I'm trying to run a .sh shell.

Edit: Yes, I had selected to allow code execution already.

  • 2
    Did you make the file executable? (Right Mouseclick on the file -> Preferences -> Permission-tab -> check Allow executing file as program). – Kai Jun 29 '14 at 12:21

This works in Unity & Gnome, similar things are there for other desktop environments (for KDE's dolphin file manager, I think you can set what you want it to do by right-clicking on the executable file and selecting 'Open With...' > 'Other')

Right click on the file, and go to Properties, and permissions. Make sure this is ticked :

Execute - TICK Allow executing file as program
(You need this ticked anyway for the file to run in terminal, or be 'executed', it is the same as running chmod +x /PATH/TO/FILE)

And make sure this, under the Behaviour tab, in Nautilus file manager's preferences, is set to this: Executable Text Files - Ask Each Time

Now every time you click on it, you should get this, which will work much the same as the right-click menu:

Do you want to run EXAMPLE.py, or show its contents - buttons

Run in Terminal, you can guess.
Display opens it in the default text editor defined in 'Open With...'. in the files preferences.
Run runs it in the background, with no terminal. This is also what happens if you select 'Run executable text files when they are opened' above.

Also, here is a fix to stop gnome-terminal closing instantly once the script has completed - go to Profile Preferences, and under Title and Command, set:

'When the command exits' to 'Hold the terminal open', Now when you run a script like this (works the same for shell scripts):

import time
print "Hello"
print "Goodbye"

(Remember the shebang #!/usr/bin/python line, otherwise it won't be interpreted correctly. You can also use #!/usr/bin/env python - for shell scripts #!/bin/bash or #!/bin/sh)

It stay open a while, then you should get something like: enter image description here

To (attempt) to get Terminal to appear in the right-click menu: I have tried the following adding this to ~/.local/share/applications/mimeapps.list under [Added Associations]:


Also I have tried adding this to gnome-terminal's launcher file (/usr/share/applications)


Neither of which seemed to work - but setting it so you can click on the File and select 'Open in Terminal' is an ideal substitute.

  • 1
    Thanks, the Nautalis executable text files behaviour setting was the problem. I'm not sure how that got changed as I didn't even know it existed. – Korakys Jul 1 '14 at 2:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.