4

I tried to use ls -dR but I don't see any difference with ls -d. Does -R do anything when there's also -d?

  • in simple experimentation, -d overrides -R ... – Jeff Schaller May 19 at 14:19
  • ... for the particular implementation(s) of ls you experimented with. – Henning Makholm May 19 at 19:50
5

POSIX says:

-R
Recursively list subdirectories encountered. When a symbolic link to a directory is encountered, the directory shall not be recursively listed unless the -L option is specified. The use of -R with -d or -f produces unspecified results.

And that:

This volume of POSIX.1-2017 is frequently silent about what happens when mutually-exclusive options are specified. Except for -R, -d, and -f, the ls utility is required to accept multiple options from each mutually-exclusive option set without treating them as errors and to use the behavior specified by the last option given in each mutually-exclusive set.

So, it may or may not make sense.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.