Re: Strange output by the "ls -l|less" command pipe in FC5

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

 



Joachim Backes [RHRK] wrote:
Mike McCarty wrote:

Joachim Backes [RHRK] wrote:

Using "ls -l|less " in FC5 gives a strange output on a fresh FC5 installation. Using "more" instead of "less" generates correct output. Did anybody make similar experiences?

ESC[00mtotal 916
-rw-r--r-- 1 root root 11942 Feb 12 09:50 ESC[00mLICENSEESC[00m


What you see here is the escape sequences for setting colors
coming out of ls. You see, "less" is translating the escape
sequences into graphic characters (like 0x1B is becoming "ESC").

Try this...

$ ls -l --color=never | less

If that looks ok (it should) try

$ ls -l --color=auto | less

That *should* also work. You may have an alias for "ls".

Mike


Hi, Mike,

You are right: there is an alias: ls='ls --color'.
Using both options in ls cmd (--color=never or --color=auto) helps.

Mine looks like this:

alias ls='ls --color=tty'

--color=auto should also work.

Anyway, I get color when it matters. You don't want it
when redirecting ls output to a file for later processing,
which is why I recommend *against* using

ls | less -r

This trick won't work, for example, with grep.

Mike
--
p="p=%c%s%c;main(){printf(p,34,p,34);}";main(){printf(p,34,p,34);}
This message made from 100% recycled bits.
You have found the bank of Larn.
I can explain it for you, but I can't understand it for you.
I speak only for myself, and I am unanimous in that!


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux