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.

What is the difference between chmod u+x and just chmod +x? I have seen a ton of tutorials that say to use u+x to make scripts executable. However, the u is not mentioned in the chmod help or manual. Omitting the u doesn't seem to have any effect either. Is it just a deprecated argument? Thanks.

share|improve this question

3 Answers 3

up vote 38 down vote accepted

The man page of chmod covers that.

  • u stands for user.
  • g stands for group.
  • o stands for others.
  • a stands for all.

That means that chmod u+x somefile will grant only the owner of that file execution permissions whereas chmod +x somefile is the same as chmod a+x somefile.

The chmod man page says:

The format of a symbolic mode is [ugoa...][[+-=][rwxXstugo...]...][,...]. Multiple symbolic operations can be given, separated by commas.

A combination of the letters 'ugoa' controls which users' access to the file will be changed: the user who owns it (u), other users in the file's group (g), other users not in the file's group (o), or all users (a). If none of these are given, the effect is as if 'a' were given, but bits that are set in the umask are not affected.

share|improve this answer

Just doing +x will apply it to all flags: [u]ser, [g]roup, [o]thers.

Type man chmod for more information.

share|improve this answer
    
I promise I checked the manual first but didn't see it since I skipped the description and jumped down to the options. I see them now though :-) –  schwiz Mar 8 '11 at 23:41

chmod u+x will made the file executable for your user (it will only add it for your user, though it may be already executable by the group owner, or "other").

chmod +x or chmod a+x ('all plus executable bit') makes the file executable by everyone.

If you do this to a directory, it makes the directory searchable, instead. I.e., you can list the contents of a directory that you have +x permission on.

share|improve this answer
    
sorry but this thing too not worked for me. I have tried it with sudo and not got it worked on my computer. askubuntu.com/questions/178231/how-to-set-permission-in-ubuntu –  Gupta Aug 20 '12 at 18:39
    
@AnkitGupta I'm not sure what you're saying. My comment wasn't intended to fix a problem in a different Q&A. Try asking for clarification to answers there instead. Edit your question to say what you've tried. Show the output. –  belacq Aug 20 '12 at 19:00

Your Answer

 
discard

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.