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?

link|improve this question

0% accept rate
feedback

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

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

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
link|improve this answer
feedback

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

link|improve this answer
feedback

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".

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.