So we all know you shouldn't parse ls for many reasons, mostly due to filenames allowing almost every character. However why has nobody been able to overcome this in an implementation of ls?

Many commands have a command line argument that will output parsable text to stdout, often csv format. Now I know filenames can have commas but so can csv files, that is a simple fix using double quotes. I guess another issue would be that filenames could also contain double quotes, but I still refuse that the open source hivemind couldn't find some solution to this. What is preventing someone from implementing a parsable option for ls?

  • Don’t the GNU ls -b and -Q options count? Feb 5, 2021 at 20:02
  • 1
    It's because of a curse: whoever dares printing filenames in a parsable format is damned to an eternity of suffering.
    – user414777
    Feb 5, 2021 at 20:07
  • 1
    Some feel that ls is only intended for "human consumption"; related; see here
    – JRFerguson
    Feb 5, 2021 at 20:09
  • 1
    @jesse_b Is this a dupe of your question? unix.stackexchange.com/questions/112125/…?
    – Kusalananda
    Feb 5, 2021 at 20:16
  • 1
    @Kusalananda: yeah it seems so
    – jesse_b
    Feb 5, 2021 at 20:17


Browse other questions tagged or ask your own question.