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

Sometimes 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/tmp

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

Get WYNTK: UNIX System Admininistrator now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.