Listing as many columns as you like

Every day solutions to every day challenges. + Brilliant stuff

Moderators: b1o, jkerr82508

Forum rules
Please feel free to post your tip it does not have to be advanced. Also ask questions directly related to the tip here. But do not start new threads with questions or ask for help here. That is what the help section is for. forum rules: http://bjoernvold.com/forum/viewtopic.php?f=8&t=568
User avatar
viking60
Über-Berserk
Posts: 9351
Joined: 14 Mar 2010, 16:34

Listing as many columns as you like

Postby viking60 » 27 May 2012, 15:54

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
Manjaro 64bit on the main box -Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz and nVidia Corporation GT200b [GeForce GTX 275] (rev a1. + Centos on the server - Arch on the laptop.
"There are no stupid questions - Only stupid answers!"

User avatar
dedanna1029
Sound-Berserk
Posts: 8784
Joined: 14 Mar 2010, 20:29
Contact:

Re: Listing as many columns as you like

Postby dedanna1029 » 27 May 2012, 18:32

I wonder if 11 columns would fit on a screen with proper readability?
I'd rather be a free person who fears terrorists, than be a "safe" person who fears the government.
No gods, no masters.
"A druid is by nature anarchistic, that is, submits to no one."
http://uk.druidcollege.org/faqs.html

User avatar
viking60
Über-Berserk
Posts: 9351
Joined: 14 Mar 2010, 16:34

Re: Listing as many columns as you like

Postby viking60 » 28 May 2012, 06:38

Yes on my screen 10 columns is pretty much the limit. I guess it depends on your equipment.
Manjaro 64bit on the main box -Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz and nVidia Corporation GT200b [GeForce GTX 275] (rev a1. + Centos on the server - Arch on the laptop.
"There are no stupid questions - Only stupid answers!"

User avatar
dedanna1029
Sound-Berserk
Posts: 8784
Joined: 14 Mar 2010, 20:29
Contact:

Re: Listing as many columns as you like

Postby dedanna1029 » 28 May 2012, 19:05

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.
I'd rather be a free person who fears terrorists, than be a "safe" person who fears the government.
No gods, no masters.
"A druid is by nature anarchistic, that is, submits to no one."
http://uk.druidcollege.org/faqs.html


Return to “Tips & Tricks”