What Is “chmod +x” Command In Linux?

Linux provides the chmod command which is used to change file and folder permission. The chmod command is provided by all major Linux distributions like Ubuntu, Debian, CentOS, Mint, Kali, RHEL, SUSE, etc. The chmod command has different options and parameters but the chmod +x is one of the most popular and used options for the chmod.

Linux is the predecessor of the Unix operating system which is the mother of the operating system families like Linux, BSD, Solaris etc. So this “chmod +x” command can be easily applied to all Unix and related variant operating systems like BSD, FreeBSD, NetBSD, OpenBSD, MacOSX, Unix without or with little difference.

What is chmod +x?

The +x parameter is used to add the x permission which is the symbol for the execute permission. The execution permission will give the execution ability to the owner user or group of the file. The + will add provided ability and - minus will remove the provided ability.

List Current User and Group Permission For A File

Before starting to use the chmod +x command for the user, group, and others we generally need to use the ls command to list current permission for user, group, and others for the specified file. Just add the -l option in order list permission, current owner user and group etc.

$ ls -l
List File Permissions

chmod +x Add Execute Privilege For User

The chmod +x can be used to add execution privilege the current owner user of the specified file. In the following example we will add execution privilege for the user ismail to the file named backup.sh.

$ chmod u+x backup.sh

chmod +x Add Execute Privilege For Group

In Linux files also have an ownership group that is similar to the owner user where the group users have given privileges over the file. The chmod +u can be used to add execution privilege for the current group of the file by using the g before +u.

$ chmod g+x backup.sh

chmod +x Add Execute Privilege For Others

The chmod +x can be also used add execute privileges for others for the specified file. Be warned that this can create security problems becuase all users can execute the specified file without any control.

$ chmod o+x backup.sh

chmod +x Numerical Permission

The +x is used to express execution privilege as a letter. There is also a numerical presentation of the chmod +x where the x is valued as 001 in binary and 1 in decimal. the chmod +x can be expressed as numerical like following commands.

$ chmod 001 backup.sh
READ  How To Send/Set HTTP Header with curl Command?

Leave a Comment