While creating a bash script, I found that this code ls puts all files on one line:
pi@raspberrypi:~/ptlrestinterface$ ls
update.sh web.config MyApp.runtimeconfig.json
still ls | head -n1 still prints only the first file:
pi@raspberrypi:~/ptlrestinterface$ ls | head -n1
update.sh
I would expect it to output the entire line, not the first file.
While piping the output through hexdump, I saw ls always put out a 0a after each entry, however on the console, it places them next to each other.
Apparently ls has some knowledge of the console (or the console of ls). How does this work, and where could I find documentation on this behaviour?