Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

What is the ending 'r' for and the leading 'd' for in file permissions on Linux?

Example:

drwxr-xr-x

I know about the user, group, others part, and I know w=write, r=read, x=execute.

But I don't know about the leading 'd' and the trailing 'r'.

Can anyone explain how this works?

share|improve this question

migrated from stackoverflow.com Jun 1 '10 at 18:04

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

add comment

3 Answers

  • 'd' means that the listing is a directory
  • 'r' means the item can be read
  • 'w' means the item can be written to (EG: modified)
  • 'x' means the item can be executed (EG: a script or program)

There are three sets of rwx permissions, which correspond to (in order from left-to-right):

  • the current owner
  • the current group
  • other users
share|improve this answer
add comment

The leading d means the entry is a directory; other possibilities include:

I don't know what trailing r you're referring to, there isn't one in your example

share|improve this answer
add comment

The hyphens in your examples aren't separators. They're placeholders for where the w's would go, so show that "group" and "others" don't have Write permission.

drwxr-xr-x is read like this: d rwx r-x r-x

d - directory

rwx - user (owner) has Read, Write, and eXecute.

r-x - group has Read and eXecute (but not Write).

r-x - others have Read and eXecute (but not Write).

I think you were misreading the hyphens as separators between the u/g/o sections, like this: drwxr - xr - x, which would explain why you thought the r's were "trailing".

share|improve this answer
add comment

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.