Tabular display in Linux terminal


A command I like in Linux is ‘column’. It allows the display of ordered data (typically CSV) in a tabular way in the Linux terminal.

For example, assume you have the following file:

$ cat data
server|location|usage
mars.example.com|New York|web
saturn.example.com|Beijing|database
mercury.example.com|Sidney|nosql

You can display this file nicely as follows:

$ column -t -s '|' data
server               location  usage
mars.example.com     New York  web
saturn.example.com   Beijing   database
mercury.example.com  Sidney    nosql

-t indicates that we want tabular display and -s specifies the separator we use. I like to use the pipe (’|’) as data separator, but usually the semi colon (’;’) is used for CSV data.