0

What is the situation why ls -l returns a list of subdirectories in the form below?

 d????????? ? ? ? ?       ? Subdirectory

A tree launched on that directory returns 0 directories, 0 files for example. The system seems to know the name of the subdirectory but cannot find it.
Which missing link confuses ls?

Late note. On directories, thus not on files, see also:

3

1 Answer 1

5

You have read, but not execute/search permissions to the containing directory.

Easy to reproduce with:

mkdir -p foo/bar; chmod -x foo; ls -l foo
ls: cannot access 'foo/bar': Permission denied
total 0
d????????? ? ? ? ?            ? bar

On Linux and BSD, ls is able to get that it's a directory from the d_type field of the directory entry, but not much more.

That may also happen in other situations where ls is not able to access the actual inode, but only the directory entry which points to it (as when the file or directory inode has disappeared before ls was able to stat() it -- see this, or when the it's an inaccessible mount point -- see this).

Not the answer you're looking for? Browse other questions tagged .