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

How can I make my file so that I can double click on it, and it runs. It is a .sh script, but I also have files that say:

executable (application/x-executable)

in the description of what they are.

I can't run any of these from terminal, or by double clicking.

If possible, I would like a way using either the GUI or a Terminal, but not a combination of the two.

Here is a screenshot of what I see when I right click then go on properties. The file first:

properties of executable file

And the shell script here:

properties of shell script

NB: I accept that this is a duplicate (I was looking for it, and couldn't find it, so asked + answered it, hoping that I would find it) however, I don't think the question about .desktop files is a duplicate.

share|improve this question

marked as duplicate by 123456, bodhi.zazen, Braiam, karel, Avinash Raj Jun 18 '14 at 4:15

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.

see the permissions tab in you screenshots. – Rinzwind Jun 17 '14 at 19:19
We need more information. Could be anything from improper permissions to unmet dependencies to incorrect path to running a windows program on linux. – bodhi.zazen Jun 17 '14 at 19:21
up vote 26 down vote accepted

There are two ways of making a file executable:

GUI Method:

Go to the permissions tab, then tick the box Execute: [✓] Allow executing file as program.

enter image description here

Terminal / Command method:

You can either use:

cd /to/my/required/directory

Then run

chmod +x filename.extension

Or just run:

chmod +x /path/to/your/filename.extension

chmod does also have some more advanced options:

The spaces are to show that it is split up: - rwx --- ---

The first set of --- is User. The second is Group and the last is Other (anyone else)

r stands for Read, w for Write and x for eXecute.

So to allow everyone to read it, but only Group to execute and User to read and write it (but for some reason not execute) would be:

-rw- rx- r-- But this would be added to the command as:

chmod +rw-rx-r-- /path/to/file.extension

chmod also can do this in numbers. It is based on binary (I think, as it is 1,2 and 4)

So there are these numbers:

Execute by user is 100. Execute by group is 010. Execute by other is 001

Write by user is 200. Write by group is 020. Write by other is 002.

Read by user is 400. Read by group is 040. Read by other is 004.

Then you add these together to get the desired combination.

So to allow everyone to read it, but only Group to execute and User to write it (but for some reason not execute) would be:

400 + 040 + 004 and 010 and 200

That adds up to 600 + 050 + 004 = 654.

You could then run the command.

chmod +654 /path/to/file.extension to set it.

And to set all permissions you can type:

chmod +rwxrwxrwx /path/to/file.extension

Or (this is a bit easier to write, but harder to remember each one):

chmod +777 /path/to/file.extension

Finally, you can do:

chmod -777 /path/to/file.extension

To take all permissions away from everyone.


chmod +300 /path/to/file.extension

To add read and write for user, without affecting any other permissions (e.g. Execute permissions).

This website has a very useful little grid checkbox thing, whereby you can tick the options you want and it gives you the command:

enter image description here

However, not all the possible combinations are sensible to use; the main ones that are used are the following:

755 - Owner has all, and Group and Other can read and execute

700 - Owner has all

644 - Owner can read and write, and Group and Other can read

600 - Owner can read and write

And, if you're using non-trivial user groups:

775 - Owner can read and write, and Group and Other can read

770 - Owner and Group have all, and Other can read and execute

750 - Owner has all, and Group can read and execute

664 - Owner and Group can read and write, and Other can just read

660 - Owner and Group can read and write

640 - Owner can read and write, and Group can read

777 and 666 are rarely used, except in /tmp.

Thanks Ilmari Karonen for pointing out the ones in common usage!

share|improve this answer
more info: chmod --help – Hannu Jun 17 '14 at 19:28
You can also: chmod +700 /path/to/your/filename.extension – Duncubuntu Jun 17 '14 at 19:38
The community help wiki is at, and would apply to this question, I suppose. Unlike Ask Ubuntu it's not a Q/A style resource. – Gunnar Hjalmarsson Jun 17 '14 at 19:40
You can also provide an answer as "community wiki", it is an option in the lower left corner of the "Answer" box. See – bodhi.zazen Jun 17 '14 at 19:48
Your screenshot shows a very bad example of file permissions. I can't think of any valid reason to ever make an executable file (or most other files, for that matter) writable by anyone, and plenty of reasons not to do that. Basically, the generally useful file permission sets (excluding advanced stuff like setuid/gid) are 755, 700, 644 and 600 (and, if you're using non-trivial user groups, 775, 770, 750, 664, 660 and 640). About the only things you should ever see with 777 or 666 permissions are /tmp (which is really 1777), device files and symlinks (whose permissions don't matter). – Ilmari Karonen Jun 17 '14 at 20:45

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