I've summarized a list of commands that accepts symbolic link options according to SUSv4-2018ed:

cd chgrp chown chmod cp find ln ls pax rm

The full list also includes their defaults and other related options supported (such as -h and -d), and I stored it on my HDD for reference.

I've previously seen (GNU documents if I was correct) referring to -P -L options as "physical" and "logical" respectively, and I think that's probably where the option letters come from, but the latest docs as of Nov 2019 refer to them as "--no-dereference" and "--dereference" now.

My question is: where do -P -L -H come from? Is it SUS, XPG, POSIX, SVID, or vendor documentation? And what do they initially stand for?

  • 1
    H is probably a variation of P where P was already taken (so they took the next alphabet in "physical") – muru Nov 22 '19 at 0:33
  • @muru So when H was introduced, the sense of "physical" and "logical" had reversed? – DannyNiu Nov 22 '19 at 1:39
  • 1
    I don't see how that can be said. IIRC -H is usually like -P, with an exception for command line arguments – muru Nov 22 '19 at 1:55
  • @muru I see. Would you consider converting your comments into an answer? I find it plausibly acceptable. – DannyNiu Nov 22 '19 at 2:11

P and L indeed refer to the physical symbolic link itself, and the logical file the symbolic link refers to.

If one goes to section A.3. subsection "symbolic link" of the Rationale volume of 2018 edition of the Single Unix Specification, all of -P -L -H are mentioned, and it says

-H (for half logical)

Thanks goes to Don Cragon (from Austin Group mailing list) for the pointer.

|improve this answer|||||
  • 1
    "Half logical" means, I believe, "resolve symbolic links given on the command line" (but not necessarily links encountered during walking a directory tree). But I'm not entirely sure. – Kusalananda Nov 22 '19 at 10:04

The short flags are Posix. But they were same in BSD before afaik.
The long flags which are much clearer are gnu as far as I can see.

Indeed the P and L are from physical an logical, but many recent documentation does not use these terms to describe because they are hard to understand. The use the terms dereferenced/followed and such.
I personally would think the final file or directory is the physical stuff while the link itself is only logical stuff, but it is used the opposite way round (so evaluation the symlink physically or logically).

|improve this answer|||||
  • You didn't mention the -H flag. – DannyNiu Nov 22 '19 at 7:41
  • There was no specific question about the meaning of -H and there is no gnu long option to compare. Though --half-dereference would be funny... – EOhm Nov 22 '19 at 21:55

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.