ls
command outputs it's result by rows:
AndroidSandbox/ kotlin-native-intellij/
arc-theme-macos/ kotlin-native-sandbox/
BobkoLauncher/ kotlin-ref-delegation/
...
How to take first n
lines of this output? ls | head -n 2
doesn't work because it will take two first files but I need two first lines of output.
Another note: both -C and -x when piped will use a default screen width. So you might want:
ls -C --width="$(tput cols)" | head