How can I see the permissions of a specific directory?
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?
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
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.