Use ls -ld to see the permissions for a directory.
When you run ls -l on a directory, you see the permissions of all the files within the directory. For example, if I type ls -l on the tmp subdirectory of my home directory, I’ll only see a listing of the files within tmp:
% ls -l ~/tmp
total 280
-r--r--r- 1 lmui 276480 Jul 18 09:21 ch01.tmp
-r--r--r- 1 lmui 115345 Jul 18 11:51 ch02.tmpSometimes you don’t want to see the files within the directory; you just want to see just the permissions on the directory itself. For that you should specify the -d command-line option as well. With the ls -ld command, you’ll see the permissions on the directory itself, not on its contents.
% ls -ld ~/tmp
drwxr-x--x 2 lmui 512 Aug 25 17:32 /home/lmui/tmpThis tells you that the directory tmp in my home directory is read/write to myself and read-only for my group. It cannot be read or written by anyone else; however, all users can cd to the directory, since it is executable for all. The initial d means that it’s a directory.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access