2

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?

1
  • 3
    That how I understand it too. Commented Sep 7, 2016 at 6:50

1 Answer 1

2

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

Thus

chown -R . 

or

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

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.