1

I'm trying to get colored less output in my terminal. Below is how I expect the output to look, and underneath that what "less -r" or "less -R" actually produces.

enter image description here

enter image description here

I'm using a build of suckless st that's collected here:

https://github.com/Lukesmithxyz/st

And I haven't really customized it at all.

I should also mention that every other terminal I've tried (including TTY2) has the same behavior.

Any ideas are appreciated.

1 Answer 1

3

You need to force ls to use colours, otherwise it disables them when not writing to a terminal:

ls -l --color | less -R

You can also use unbuffer (part of expect):

unbuffer ls -l | less -R

See How to trick a command into thinking its output is going to a terminal for more information on the latter approach.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .