Re: binary output from ls
Ivan Glushkov wrote:
David Kirchner wrote:
On 2/15/06, Ivan Glushkov <firstname.lastname@example.org> wrote:
if I issue ls . > filelist.txt
as user I get:
a binary file like:
if I do that like root, I get the list of files as expected.
What is the difference? Both root and the user are using the same shell.
Unfortunately, by default, ls uses colors to highlight directories and
executables (and others). The default alias provided in .bashrc, with
a stock install, is 'ls --color=auto'. auto is supposed to tell ls to
ensure it is connected to a tty (instead of a file) before spitting
out colors. If that alias is 'ls --color=always', it will always use
colors, regardless of the output.
The solution will be found in your .bashrc file -- either change the
alias to 'ls --color=auto' or remove it entirely, and it should work
Thank you all,
Just for the record:
I am using zsh, and I was having in my ~/.zshrc the following line:
alias "ls=ls --color"
now I changed that to:
alias "ls=ls --color=auto"
and everything looks fine.
For those cases where you don't/can't see color, you may
find that the -F option to ls gives you the same information,
if in not quite so obvious a way. I used to use -F all the time,
and had it aliased that way permanently.
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!