Colour output piped to less

Posted by mmacaulay on Stack Overflow See other posts from Stack Overflow or by mmacaulay
Published on 2010-03-27T20:37:51Z Indexed on 2010/03/27 20:43 UTC
Read the original article Hit count: 375

Filed under:
|

Operating system: Mac OS 10.6.2

I'd like to be able to see colour output when piping certain commands through less.

Two examples:

I've got ls aliased to ls --color=auto, so I'd like to be able to see colour when I do this:

ls -l | less

I've also got the color extension turned on in Mercurial, so I'd like to see colour output from:

hg diff | less

and

hg st | less

After some googling, it seems like some versions of less support either -r or -R to make this work, but no dice for me. I can't see anything in the man page that looks like what I need. (-r or -R SEEM to be the right options, but again, they don't seem to work)

© Stack Overflow or respective owner

Colour output piped to less

Posted by mmacaulay on Super User See other posts from Super User or by mmacaulay
Published on 2010-03-27T20:37:51Z Indexed on 2010/03/27 21:03 UTC
Read the original article Hit count: 375

Filed under:
|

Operating system: Mac OS 10.6.2

I'd like to be able to see colour output when piping certain commands through less.

Two examples:

I've got ls aliased to ls --color=auto, so I'd like to be able to see colour when I do this:

ls -l | less

I've also got the color extension turned on in Mercurial, so I'd like to see colour output from:

hg diff | less

and

hg st | less

After some googling, it seems like some versions of less support either -r or -R to make this work, but no dice for me. I can't see anything in the man page that looks like what I need. (-r or -R SEEM to be the right options, but again, they don't seem to work)

© Super User or respective owner

Related posts about command-line

Related posts about less