Is it possible to colorize output piped to more?

The problem isn't that more and less aren't colourizing their output, it's that ls is not outputting the colour because it's connected to another process rather than the terminal.

You can't easily get ls to be any smarter about when it outputs colour, but you can add --color to force it to output colour when you're piping it to more

When you have colour output, use ... |less -R to make less pass the colours through to the terminal instead of showing the escape codes as text


ls --color | less -r

Tested on Linux, GNU userland.