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
ls | wc -l
returns the number of files and folders. – mrmowji Jun 22 '20 at 08:26lsc
on page 5). – Quasímodo Jul 19 '21 at 20:47