What Does “chmod +x” Command In Linux and Unix?


chmod  is very useful tool to manage file modes like read write execute. One of the most used option for chmod is +x which stands for execution rights. In this tutorial we will look different use cases for user or owner, group and others roles.

List Current User and Group Of A File

We generally need to know given file current user and group. We will use ls  command with -al options in order to list this information.

$ ls -al app.sh
List Current User and Group Of A File
List Current User and Group Of A File

Change File Mode For The User

We can use u user before the plus in order to enable user execution right of the given file. In this example we will enable user execution of file app.sh

$ chmod u+x app.sh

Change File Mode For Group

We can use g group before the plus in order to enable group execution right of the given file. In this examples we will enable group execution of file app.sh

$ chmod g+x app.sh

Change File Mode For Other

Others is special group which covers all users in a Linux system. We can enable the execution right of the all users in a file with o like below.

$ chmod o+x app.sh

Change File Mode For All

In some cases we can see the +x  without a definition. This is used for all which is equivalent for user , group and others . Alternative is adding a like below.

$ chmod a+x app.sh

OR

$ chmod +x app.sh

LEARN MORE  What is chmod 777?

Leave a Comment