[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: less and color



My issue with this is that while 

--
ls --color=always | less -r
--

works nicely, 

--
ls --color=always > file.txt
--

does not ( color codes ). I would like to include aliases to 'ls' and 'less' in
my login profile to have '--color' and '-r' respectively, but run into the 
aforementioned problem.

I feel too conditioned to type 'ls --color=always | less' in place of
'ls | less', but maybe that's just me ;)

I suppose an "alias 'lsl=ls --color=always | less -r'" does the trick,
but I would rather not use non-standard directory listing commands. whatever.

Maybe some way to make 'less' pretend to be a tty ( !? ) would let 'ls --color=auto' work?


-rob



On Thu, Jan 27, 2000 at 03:47:33PM +0100, Matus fantomas Uhlar wrote:
> -> I have got the same problem with 'more' and 'less' too.
> -> 
> -> How did you configure 'ls' for displaying colors when piping to 'more' ?
> 
> -> I have setup the ls command to use the display color option using an
> -> alias.  It works fine.  Colors are also displayed nicely when piping
> -> ls stdout to the more command.  I want to use less instead of
> -> more.  However, when piping ls stdout to the less command, less displays
> -> the directory listing in b/w and with control characters (escape seq with
> -> hex numbers?) around the filenames instead of just using the correct
> -> colors.
> 
> that's problem of lls not less try
> 
> ls --color=always | less -r
> 
> but the problem is in that case less doesn't know how long the line is and
> doesn't correctly diaplay it.
> -- 
>  Matus "fantomas" Uhlar, sysadmin at NEXTRA, Slovakia; IRCNET admin of *.sk
>  uhlar@fantomas.sk ; http://www.fantomas.sk/ ; http://www.nextra.sk/
>  Enter any 12-digit prime number to continue.
> 
> 
> -- 
> Unsubscribe?  mail -s unsubscribe debian-user-request@lists.debian.org < /dev/null
> 


Reply to: