Make ls print it all on one line (like in terminal)

i don't know of a switch which could do that, but you can pipe your output through tr to do it:

ls | tr "\n" " " | <whatever you like>

ls | xargs

It works for me, it's the simplest way I've found ever. Hope this helps you as well.


If your ls has this option, you can use a high value and it might do what you want:

ls -w 10000 -C . | head