Less and ANSI colour escape sequences

Suvayu Ali fatkasuvayu+linux at gmail.com
Tue Oct 27 09:19:55 UTC 2009


Hi Siddhesh,

Thanks for your reply.

On Tuesday 27 October 2009 01:02 AM, Siddhesh Poyarekar wrote:
> On Tue, 2009-10-27 at 00:58 -0700, Suvayu Ali wrote:
>> I was wondering why `less' in Fedora 11 can't display ANSI colour escape
>> sequences even with the `-r' or `-R' options. I use grep as `grep
>> --color=always'. When I pipe the output to `less -R' or `less -r' all
>> the colours are lost. This works on my Xubuntu machine at the
>> University. Is this a bug with the Fedora package?
>>
>
> Both work for me on F11:
>
> $ grep --color=always foo somefile | less -R
> $ grep --color=always foo somefile | less -r
>
> Works even if I alias grep to 'grep --color=always'
>
> Are you doing something different?

I have `less' aliased to `less -i'. But to test it I removed it, still 
doesn't work for me. :(

$ type less
less is /usr/bin/less
$ type grep
grep is aliased to `grep --color=auto'

And still a command like this

$ locate emacs|grep -E 'png|svg'|less -R
$ locate emacs|grep -E 'png|svg'|less -r

doesn't give me colour coded output. Whereas I get colours when I remove 
the pipe to less.
-- 
Suvayu

Open source is the future. It sets us free.

-- 
Suvayu

Open source is the future. It sets us free.




More information about the users mailing list