Output from ls has newlines but displays on a single line. Why?
83
votes
2
answers
81411
views
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 text3
**od** shows that the output is separated by newlines:
cpoweradm@debian:~/lpi103-4$ ls text* | od -c
0000000 t e x t 1 \n t e x t 2 \n t e x t
0000020 3 \n
0000022
If newlines are present, then why doesn't the output display as:
text1
text2
text3
Asked by theconnorpower
(1049 rep)
Apr 1, 2011, 02:31 AM
Last activity: Sep 12, 2019, 07:09 PM
Last activity: Sep 12, 2019, 07:09 PM