I'm using Ubuntu and I've created a simple script file:

cp /home/guilherme/pictures/*.jpg /home/guilherme/backup

When I run it on terminal typing the command "./script.sh" it works fine.

But when I try to click on this file outside the terminal, it opens my text editor to edit the lines of the script instead of opening the terminal and execute the commands.

I already gave the executable permission to this file, but it does not run.

Any ideas?

  • Have you tried removing the .sh extension? Maybe Nautilus (or whatever file browser you're using) checks that. – tjameson Jul 13 '13 at 1:59
  • yeah, I removed the extension and nothing happens – user2576376 Jul 13 '13 at 2:02
  • please send us ls -la of the script. check that the mountpoint is not mounted noexec. – mnagel Jul 13 '13 at 2:52
  • This is surely not a programming question--please ask on SuperUser instead. – John Zwinck Jul 13 '13 at 4:17

You have to open nautilus, click File->Preferences (OR) Edit->Preferences, check Behaviour tab, and select the option you prefer for Excutable Text Files.

enter image description here


On Ubuntu 14.04:

  1. Open Nautilus .
  2. Hit Alt.
  3. Type preferences.
  4. Hit Enter.
  5. Choose Behavior tab. Under Executable Text Files choose Ask each time.

You also need to mark your files as executables. To do that right click the .sh file, choose Properties, and under the Permissions tab check Allow executing file as a program.


Go to your system settings -> keyboard -> keyboard shortcuts and add a custom shortcut. For the command place the full path to the script. Now you can run it without terminal

  • how if it needs password to run? – Ravan Jan 10 '16 at 10:52

in terminal type "chmod +x filepath". This will convert your sh file to an executable file that will run when you open it

  • 2
    Your answer is incorrect. It does not change it into a executable. Please delete your answer. – fosslinux Jun 23 '16 at 0:52

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.