0

Monitors tend to be more wide than tall. When there's hundreds of files in a folder, ls -l and ls -l | more will only show you me maybe 100 files at a time, due to the lack of vertical space on the screen. But my screen has enough horizontal space to have at least three columns of ls -l output (see here for an example of ls -l output on my screen).

All suggestions to change the number of columns of ls output, such as:

ls -C
ls | col
ls --width=2
ls | xargs -n 
ls  --tabsize=2
ls  --format=vertical

seem not to improve my ls -l output.

I browsed all options given in man ls. Is there any way to get the ls -l output, but multiple columns of it rather than one? Even a two-column output would be so helpful!

Nike Dattani
  • 237
  • 2
  • 14
  • @cryptarch Not really, because the highest voted answer suggested to do `column` followed by a second command, whereas `column ls` gives an error. I wouldn't call this a duplicate because we're asking for different things, and that question didn't come up in my the searches that I made prior to asking this question: multicolumn "ls -l", two column "ls -l", more than one column "ls -l", etc. The solution turned out to be be a hybrid between the lowest scored answer (append `| columns` to the end) and the highest voted answer (use `column` without the `s` at the beginning). – Nike Dattani Jan 18 '23 at 00:50
  • The highest-voted answer suggests to use `command` with a *file*, not a command. You can pipe input to `column` too, as you discovered. – Stephen Kitt Jan 18 '23 at 05:29
  • @StephenKitt isn't that what my answer says? – Nike Dattani Jan 18 '23 at 05:30
  • 1
    Yes, that is what your answer says, but it seems to me you dismissed the linked answer based on a misunderstanding (`command ls`, which isn’t what the linked answer suggests). Note that a duplicate doesn’t mean that the *questions* are the same, just that the answers apply to both; and the fact that a question didn’t turn up in your searches doesn’t matter. – Stephen Kitt Jan 18 '23 at 05:38

1 Answers1

0

The answer turns out to be:

ls -l | column 

Thank you cryptarch for suggesting this similar question!

Nike Dattani
  • 237
  • 2
  • 14
  • Ha, no worries. Personally I thought something like `pr -t -w180 -2` (similar to one of the answers) gives better output than `column`, but your call :) – cryptarch Jan 18 '23 at 00:49
  • 1
    @cryptarch thanks! The best I managed to get with `pr` was `ls -l -t | pr -t -w200 -3` which looks the same as `ls -l |column` but more squished. I haven't yet been able to get `ls -l -t | pr -t -wXXX -4` as I have to play around with the `XXX` value to make sure nothing gets cut-off. It seems to be a more powerful solution if used properly, but also more complicated and screen-dependent. – Nike Dattani Jan 18 '23 at 00:55