Page 1 of 1

Listing as many columns as you like

Posted: 27 May 2012, 15:54
by viking60
This is not very high tech but I find myself using it quite a lot.
Often when I do a ls I get 8 columns and little water between the boats. Other times I want more columns due to the volume. So I made some aliases like this and put it in my ~/.alias file:

Code: Select all

alias ls4='ls | pr -T4 -W$COLUMNS'
alias ls5='ls | pr -T5 -W$COLUMNS'
alias ls6='ls | pr -T6 -W$COLUMNS'
alias ls7='ls | pr -T7 -W$COLUMNS'
alias ls8='ls | pr -T8 -W$COLUMNS'
alias ls9='ls | pr -T9 -W$COLUMNS'
alias ls10='ls | pr -T10 -W$COLUMNS'


So if I want to list everything in 4 columns I only have to do a ls4 5 columns = ls5 etc.
There will be no prizes for guessing what line to add to get 11 columns :-D

Re: Listing as many columns as you like

Posted: 27 May 2012, 18:32
by dedanna1029
I wonder if 11 columns would fit on a screen with proper readability?

Re: Listing as many columns as you like

Posted: 28 May 2012, 06:38
by viking60
Yes on my screen 10 columns is pretty much the limit. I guess it depends on your equipment.

Re: Listing as many columns as you like

Posted: 28 May 2012, 19:05
by dedanna1029
And, what resolution one's on, I suppose.

We learned about columns in Unix last quarter in school. I still didn't get it, the way we were taught. This is good so that I don't get confused with them any more.

I came to find out about half-way through the course, that we were using Ubuntu the whole time (in a way that mimiced tty). I asked why not any other of the what, hundreds of distros, we had to use Canonical. Made the class not as fun as it could have been.