Why was -H and -L choosen for –dereference-command-line and –dereference in ls as well as for example du?

Why was -H and -L choosen for respectively --dereference-command-line and --dereference in ls as well as for example du?

I guess -H and -L were thought to be less commonly used, so could be used in multiple utilities without conflicts. If there is no good historic reason, maybe someone has a good mnemonic device.

Asked By: justsome631

||

The choice of letters is explained in man symlink (e.g in the OpenBSD version or the Linux version): a tree walk without dereferencing symlinks to directories is called a physical walk (it follows the “physical” directory structure only), a tree walk dereferencing symlinks to directories is called a logical walk (it follows the “logical” structure overlaid by symlinks on top of the physical structure).

-L means “logical”, and -H “half-logical” (it starts its tree walk logically then switches to a physical walk). You’ll also find -P for “physical”, e.g. cd -P.

Answered By: Stephen Kitt
Categories: Answers Tags:
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.