00 Votes

Linux: Difference between "chmod +x" and "chmod u+x"

Question by Guest | 2016-07-23 at 18:14

At the moment, I am working with batch scripts on Linux for the first time. I have already created a file containing my script and I also know how to mark this file as executable in order to make it runable.

However, I have seen several different ways and procedures to do that on the Internet. In one tutorial, they say that you have to use "chmod +x", on another website "chmod u+x" is mentioned.

I have tried both and obviously there is no difference. Both methods are working in the same way. Or is there any difference? What should I use better? Should I prefer one way?

ReplyPositiveNegative
0Best Answer0 Votes

The "u" is standing for user. That means that the executable flag only applies to the current user of the file.

The following is possible:

  • u for user (the user who is owner of the file
  • g for group (other users in the file group
  • o for others (users not in the file group
  • a for all (all users)

If you are using "chmod +x", this is the same as "chmod a+x" - the modification applies to all.

However, it is also possible to combine multiple letters, for example "chmod ugo-x" or "chmod ug-x" for the owner of the file as well as the other users of the file group.

By the way, with "chmod -x" you can abolish the executability again. The minus sign removes the flags, the plus sign adds them.
2016-07-23 at 23:58

ReplyPositive Negative
Reply

Related Topics

"G" or "E" sign on my mobile

Question | 1 Answer

Important Note

Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.

Participate

Ask your own question or write your own article on askingbox.com. That’s how it’s done.