Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Every time I want to run a .sh file, Ubuntu asks whether I want to Run in Terminal/Display/Run it. Is there a way to set default action for some sh files?

-- I am using Ubuntu 12.04 without any special changes.

share|improve this question
up vote 4 down vote accepted

Making each .desktop files for Run in Terminal or Display or Run , you can set default action for each sh files.

Execute authority is given to each .desktop files.

For example:

  • Run in terminal

Filename : sample-term.desktop

[Desktop Entry]
Name=Run in terminal

Click this file, it will be able to run in terminal.

  • Display

Filename : sample-edit.desktop

[Desktop Entry]
Name=Edit script
Exec=gedit '/fullpath_to_script/'

Click this file, it will be able to edit by gedit.

  • Run

Filename : sample-run.desktop

[Desktop Entry]
Name=Run script

Click this file, it will be able to run

share|improve this answer

Open Nautilus, then go to Edit -> Preferences. Open Behavior tab and you'll find the options to set the file manager behavior when you open executable text files.

share|improve this answer
well, isn't there a way to specify it only for some files? An option like: remember action for this file? – Amir Ali Akbari Jul 27 '12 at 14:49
I don't think so. – Eric Carvalho Jul 27 '12 at 15:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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