This question already has an answer here:

I just install Ubuntu. One of the things I miss about windows is the lack of executable.

When I right click the .sh file, go to permissions, and check "Allow executing as a program", it never does execute as a program when I double click it.

Another solution I found is doing it in the terminal. This doesn't work either. enter image description here

What am I doing wrong? Is this really too stupid of a question or am I too stupid? Thanks for any help!

marked as duplicate by Alaa Ali, g_p, Eliah Kagan, Sylvain Pineau, Eric Carvalho Sep 30 '14 at 10:42

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.

  • Just try this, no need to make it executable: sh ./ts3client_runscript.sh and see what happens, you're probably running it correctly, but the application doesn't work (crash, etc.) – Mahdi Sep 30 '14 at 2:59

After you run chmod +x your shell script became executable. Now you can run it


from the directory script lives in. Its a bit tricky, don't forget to put ./ in front of shell script file name.

  • 1
    The "./" is only needed when the script is not in your execution path. On Ubuntu, the current directory is not searched for executables by default, only the execution path. Specifying "./" forces it to search the current directory. – thomasrutter Sep 30 '14 at 4:29

After giving it the permission to run then go to edit menu and click on preferences, then click on behavior tab, after that you will see an entry named "Executable text files" there check the 'Ask each time' radio button. Now you can run it by double clicking and by selecting 'run'.


For executing script in Linux first of all you have to give full permission.

commands for full permission:

 sudo chmod 777 ts3client_runscript.sh


 sudo chmod a+x ts3client_runscript.sh

then you can run your script by this command


open the file to check if the sha bang (first line) is #!/bin/bash. after this, try to execute the file by using shell like this: sh your_file.sh

  • The "sh" is not strictly necessary, you just need to make sure the executable bit is set, then you can run it as in /path/to/script.sh – thomasrutter Sep 30 '14 at 4:33
  • but he have to know if the right shell is selected – hermest Sep 30 '14 at 4:40
  • The shebang should take care of that - as you describe in the first part of your answer. – thomasrutter Sep 30 '14 at 4:51
  • 1
    @BriceFouthe A #!/bin/bash hashbang line causes it to be run by bash when invoked as ./your_file.sh (or /path/to/your_file.sh). But sh your_file.sh runs it with sh (which on Ubuntu is a different shell from bash; sh is dash). I recommend editing this answer to clarify what shell you're recommending attempting to run the script with (or what the considerations are that you'd suggest be taken into account when deciding that). Without that information, it's not really clear how best to use this answer. – Eliah Kagan Sep 30 '14 at 5:03

What you have done by running the command chmod +x nameofshell.sh is, you made the shell to be executable as a program. Now it is executable, so that you can execute it. You cant make the execution process by simply double clicking it. To do this,Open terminal by alt+ctrl+T, go to the directory containing the shell using the command cd /path/to/location/ and then type


Hit enter! Done!

  • 1
    /path/to/location/nameofshell.sh should be sufficient--after all, ./ works because it causes the name to contain a / character and thus be interpreted as the path to a specific script to be run (preventing $PATH from being searched instead). The only situation where cd /path/to location; ./nameofshell.sh would be necessary is if the script is written in such a way as to assume it's run with the present working directory as its own location, or if the user otherwise needs to be in that directory for something they are doing. – Eliah Kagan Sep 30 '14 at 5:05
  • Ya, you said the point right. But I just wrote the most widely used method here because he seems to be a newcomer to shell scripting. – Anandu M Das Sep 30 '14 at 5:08

How about this command:

sudo sh ts3client_runscript.sh
  • "sudo" is not necessary unless for some reason the script needs to be run with superuser privileges. "sh" is not necessary unless the script has no executable permission set. – thomasrutter Sep 30 '14 at 4:32
  • 1
    Running the script by passing it as an argument to sh may be necessary if the script has no hashbang line and the shell being used isn't sh, or if the script's hashbang line is something other than #!/bin/sh but the user wants to force it to be run with sh instead. (And usually, sh scriptname must be replaced with ./scriptname or some other path to the script containing a /.) – Eliah Kagan Sep 30 '14 at 5:08

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