Align output from commands using column

The column command is a little shell command that makes it easy to print the results in a aligned fashion.

Example 1

/dev/mapper/vg0-root  on  /              type  ext3    (rw,errors=remount-ro)
tmpfs                 on  /lib/init/rw   type  tmpfs   (rw,nosuid,mode=0755)
proc                  on  /proc          type  proc    (rw,noexec,nosuid,nodev)
sysfs                 on  /sys           type  sysfs   (rw,noexec,nosuid,nodev)
procbususb            on  /proc/bus/usb  type  usbfs   (rw)
udev                  on  /dev           type  tmpfs   (rw,mode=0755)
tmpfs                 on  /dev/shm       type  tmpfs   (rw,nosuid,nodev)
devpts                on  /dev/pts       type  devpts  (rw,noexec,nosuid,gid=5,mode=620)
/dev/mapper/vg0-home  on  /home          type  ext3    (rw)
/dev/mapper/vg0-tmp   on  /tmp           type  ext3    (rw,nosuid)
/dev/mapper/vg0-var   on  /var           type  ext3    (rw)

Example 2

cat /etc/passwd | column -t -s ":"


column -t -s ":" /etc/passwd

Result example 2

lp           x   7      7      lp                                  /var/spool/lpd         /bin/sh
mail         x   8      8      mail                                /var/mail              /bin/sh
news         x   9      9      news                                /var/spool/news        /bin/sh
uucp         x   10     10     uucp                                /var/spool/uucp        /bin/sh
proxy        x   13     13     proxy                               /bin                   /bin/sh
www-data     x   33     33     www-data                            /var/www               /bin/sh
backup       x   34     34     backup                              /var/backups           /bin/sh
list         x   38     38     Mailing List Manager                /var/list              /bin/sh
irc          x   39     39     ircd                                /var/run/ircd          /bin/sh
gnats        x   41     41     Gnats Bug-Reporting System (admin)  /var/lib/gnats         /bin/sh
nobody       x   65534  65534  nobody                              /nonexistent           /bin/sh

The column command supports the following options

-c      Output is formatted for a display columns wide.

-n      By default, the column command will merge multiple adjacent delimiters into a single delimiter when using
         the -t option; this option disables that behavior.

-s      Specify a set of characters to be used to delimit columns for the -t option.

-t      Determine the number of columns the input contains and create a table.  Columns are delimited with whites‐
         pace, by default, or with the characters supplied using the -s option.  Useful for pretty-printing dis‐

-x      Fill columns before filling rows.