13

I know that I can use ls -l to list all the files in a directory including their permissions, but how do I see the permissions of a specific directory. For example if I wanted to see the permissions for my /etc directory?

18

Add -d to the command like so:

ls -ld /etc

From man ls:

   -d, --directory
          list directory entries instead of contents, and do not dereference symbolic links
| improve this answer | |
7

Also you can use stat command to getting permissions of specific file or directory:

 stat -c "%A %n" Directory-or-File

or permission in octal mode:

 stat -c "%a %n" Directory-or-File
  • The -c option allows you to customize the output.
  • The file’s name is shown as a result of %n, %a shows octal permissions and %A shows permissions in human readable form.
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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