Archive for November, 2012

Column formatting

Here is a quick tip on how to make the output of some tools prettier, for example we can use the mount command which by default looks like this

/dev/sda1 on / type ext4 (rw,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
none on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
none on /dev type devtmpfs (rw,mode=0755)

Using the column command with the -t option we can apply some formatting so it is more readable:

$ mount | column -t

/dev/sda1  on  /                         type  ext4        (rw,errors=remount-ro)
proc       on  /proc                     type  proc        (rw,noexec,nosuid,nodev)
none       on  /sys                      type  sysfs       (rw,noexec,nosuid,nodev)
none       on  /sys/fs/fuse/connections  type  fusectl     (rw)
none       on  /sys/kernel/debug         type  debugfs     (rw)
none       on  /sys/kernel/security      type  securityfs  (rw)
none       on  /dev                      type  devtmpfs    (rw,mode=0755)
Advertisements

, ,

Leave a comment

%d bloggers like this: