2

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.

fpf3
  • 344
  • 1
  • 2
  • 9

1 Answers1

4

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.

Stephen Kitt
  • 434,908