Super User is a question and answer site for computer enthusiasts and power users. 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

I am shocked that I still don't understand "Execute" permission in Linux.

There are three permission - read, write, and execute. I understand that read and write literally, but what does execute do exactly?

Let's say I have example.php with execute permission. What can I do with example.php?

share|improve this question

migrated from Mar 9 '10 at 0:14

This question came from our site for professional and enthusiast programmers.

up vote 20 down vote accepted

Basically it means you can tell the operating system to run the code in the file. For example, if the file was a binary executable, write access would allow you to modify it, read access would allow you to view it, but without execute permissions you would not be able to run the program. In the case of a script, its a little more complicted, because you don't necessarily need to 'run' the program, you can just read its contents into an interpreter, which itself has the execute privelige, but you do not need execute permissions on the script itself.

Some scripts in Linux are themselves executable, you will often see a line at the top like

#!/bin/bash or


That line tells the kernel that the file can be executed by calling the relevant program (and isn't just text). Then you can just run your script like


instead of having to do

python ./script

share|improve this answer
What does this mean for non text-based filetypes eg. .png or .avi? – iono Jul 17 '14 at 6:10
Basically the same, the file extension doesn't matter. If you have #!/bin/bash at the beginning of your .avi file, it will be executed as bash. If it is a real avi format, you probably won't be able to run it because interpreting it as commands will not make sense and fail. – Mifeet Aug 19 '15 at 14:19

"execute" allows the user to execute executables. For directories it is the allowance to enter the directory using the cd command.

share|improve this answer
+1 for permission effect on a directory – JannieT Jan 21 '12 at 10:06

It's for running apps from gui or command line. For "normal" php use (via webserver) that doesn't change anything. Precisely speaking it depend on configuration, but in most common cases You don't need +x permission to allow loading your php webpage via browser).

For running from commend line You need:

  • add #!/usr/bin/php at the script beginning
  • add +x permission
  • Your script mast be in executable search path ($PATH environment variable) or You have to use ./ before your script name
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .