Arrange long Command Output in Columns

21 Feb

There's this one command whose output you need to look at again and again. It's a long list of short words and whizzes by too fast and using your terminal's scroll function is cumbersome. Of course there's more or less, but that is cumbersome, too!

Searching the web for a solution only leeds to more complex problem, until on the third try I found column.

It does exactly what I want without adding any options, and it's already installed as part of util-linux (1). Example:

fluxbox -list-commands | column

(1) One of these days I'm going to have to take a closer look at util-linux. It includes 110 executables!
pacman -Ql util-linux | sed -n 's/^.*\/bin\///p' | wc -l
Another usage example for column:
pacman -Ql util-linux | sed -n 's/^.*\/bin\///p' | column.

That, and coreutils:
pacman -Ql coreutils | sed -n 's/^.*\/bin\///p' | column.

For Debian-based systems try something like
dpkg -L coreutils | sed -n 's/^.*\/bin\///p' | column.

Oops, my debian machine lists only 37 packages for util-linux:
dpkg -L util-linux | sed -n 's/^.*\/bin\///p' | wc -l

Next Post Previous Post