I think I may be overlooking a relatively fundamental point regarding shell. Output from the ls command by default separates output with newlines, but the shell displays the output on a single line.Can anyone explain this to me? I had always presumed that the output was simply separated by spaces, but now that I see the output separated by newlines, I would expect the output to be displaying on separate lines.Example:cpoweradm@debian:~/lpi103-4$ ls text*text1  text2  text3od shows that the output is separated by newlines:cpoweradm@debian:~/lpi103-4$ ls text* | od -c0000000   t   e   x   t   1  \n   t   e   x   t   2  \n   t   e   x   t0000020   3  \n0000022If newlines are present, then why doesn't the output display as:text1 text2text3
Output from ls has newlines but displays on a single line. Why?
bash;terminal;ls;od
When you pipe the output, ls acts differently.This fact is hidden away in the info documentation:If standard output is a terminal, the output is in columns (sorted vertically) and control characters are output as question marks; otherwise, the output is listed one per line and control characters are output as-is.To prove it, try runninglsand thenls | lessThis means that if you want the output to be guaranteed to be one file per line, regardless of whether it is being piped or redirected, you have to runls -1(-1 is the number one)Or, you can force ls | less to output in columns by runningls -C(-C is a capital C)