Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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

2 Answers 2

up vote 3 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 sample1.sh in terminal.

  • Display

Filename : sample-edit.desktop

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

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

  • Run

Filename : sample-run.desktop

[Desktop Entry]
Name=Run script

Click this file, it will be able to run sample3.sh.

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.