4

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

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.

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.