ls in terminal, output is variously colored:
AFAIK this colorasing is accomplished by espace sequences (vt).
ls | hexdump -cC shows only characters and LFs. Redirection to file leads to similar results.
How is that?
ls only outputs escape sequences for colorized text when writing to a terminal, not when redirected to a file or pipe.
For that, use
ls manual says:
Using color to distinguish file types is disabled both by default and with --color=never. With --color=auto, ls emits color codes only when standard output is connected to a terminal. [...]
I'm guessing that your
ls command behaves like
ls --color=auto by default, possibly through the use of an