Tell me more ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Possible Duplicate:
How do I run .sh files in Terminal?

When I try to run a .sh script in Terminal it says I have no permissions to do that. And when I try to run an executable nothing happens at all!

share|improve this question
You can start by adding to the question the commands you are using to run it on a terminal, the output of ls -l while on the script's folder and any further steps you tried and what errors you get when trying to run the script. Add that information to the question instead of adding it as a comment. – Bruno Pereira Dec 25 '11 at 12:15
chmod +x a.sh; ./a.sh (make it executeable first). – YumYumYum Dec 25 '11 at 12:45
That's a hard guessing game. First, provide the output of ls -l script.sh, and a first line of your script. – Andrejs Cainikovs Dec 25 '11 at 18:55

marked as duplicate by Marco Ceppi Dec 26 '11 at 0:17

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

4 Answers

In addition to what Azendale has said, I have also found that after adding the "chmod a+x" attribute to the file removing the extension some times helps as well such as "filename.sh" or "filename.bin" becomes just "filename"

share|improve this answer

To make it executable through a GUI, right click on the file in Nautilus, then select Properties. Go to the Permissions tab and check the "Allow executing file as program" box.

enter image description here

share|improve this answer

In addition to chmod a+x as advised above, if you put the script in ~/bin it will be added to your path. If you want other users to use the script, put it in /usr/local/bin

share|improve this answer

Instead of telling if you can run a file by whether it ends in .exe like Windows does, Linux has a file permission that says who (if anyone) can run that file as a program. It is called the executable bit.

If you run

 chmod +x scriptname.sh

it will make it so you are allowed to run it. Then to run it, do

 ./scriptname.sh
share|improve this answer

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