Take the 2-minute tour ×

What is the command with which you can directly view the permission bits of a directory?

share|improve this question
add comment

1 Answer

up vote 15 down vote accepted

There's a couple ways. stat is used to show information about files and directories, so it's probably the best way. It takes a format parameter to control what it outputs; %a will show the octal values for the permissions, while %A will show the human-readable form:

$ stat -c %a /
$ stat -c %A /
$ stat -c %a /tmp
$ stat -c %A /tmp

Another (probably more common) way is to use ls. -l will make it use the long listing format (whose first entry is the human-readable form of the permissions), and -d will make it show the entry for the specified directory instead of its contents:

$ ls -ld /
drwxr-xr-x 22 root root 4.0K Apr 28 20:32 /
$ ls -ld /tmp
drwxrwxrwt 7 root root 12K Sep 25 22:31 /tmp
share|improve this answer
add comment

Your Answer


