From the chown manpage:

The following options modify how a hierarchy is traversed when the -R option is also specified.  If more than one is specified, only the final one takes effect.

-H     if a command line argument is a symbolic link to a directory, traverse it

-L     traverse every symbolic link to a directory encountered

-P     do not traverse any symbolic links (default)

What is the exact difference between the -H and -L options? As I understood it, -H allows for directory symlink traversal only when that directory is specified as argument, where -L traverses all directory symlinks in any case. (These options apply only when chowning recursively using the -R option. In non-recursive mode, a directory symlink specified as argument is always traversed.) Is this correct?


Your understanding is correct; these options match the same options in find.


chown -R .


chown -R -P .

changes the owner recursively without de-referencing any symlinks;

chown -R -H *

changes the owner recursively, de-referencing any symlinks in the current directory (since they end up being part of the arguments) but

chown -R -H .

still doesn't de-reference any symlink, and finally

chown -R -L .
chown -R -L *

both de-reference syminks.

(As an aside for the examples above, note that . and * don't necessarily result in the same outcome, depending on your shell's globbing options — * typically doesn't match dotfiles.)

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.