column(1)
Format input into multiple columns with aligned text.
Synopsis
column [OPTION]... [FILE]...Description
The column command reads input from files or stdin and formats it into multiple aligned columns. It automatically detects the optimal column width and number of columns based on terminal width, making output more readable and compact.
This is particularly useful for displaying lists, tabular data, and command output in a visually organized way. By default, it fills columns from left to right.
Common options
| Flag | What it does |
|---|---|
-t | Treat input as tab-separated values; align columns by the delimiter |
-s DELIM | Use DELIM as the column separator character instead of whitespace |
-c WIDTH | Set the maximum output width to WIDTH characters |
-x | Fill columns horizontally (left-to-right) instead of vertically |
-n | Sort columns in ascending order |
-o OUTPUT | Use OUTPUT as the string to separate columns in output |
-T | Determine column types and align appropriately (numbers right, text left) |
-e | Treat consecutive spaces as a single separator |
-R COLS | Right-align columns specified by comma-separated list COLS |
-J COLS | Left-align columns specified by comma-separated list COLS |
Examples
Format a list of filenames into multiple aligned columns
ls -1 | columnDisplay passwd file as aligned columns using colon as separator
column -t -s: /etc/passwdFormat fruit names into columns with maximum width of 20 characters
echo -e 'apple\nbanana\ncherry\ndate' | column -c 20Format mount output into tab-aligned columns for better readability
mount | column -tDisplay process list with aligned columns separated by tabs
ps aux | column -tFill columns from left to right (horizontal fill) instead of top-to-bottom
column -x file.txtFormat netstat output into columns using LISTEN as a separator
netstat -l | column -t -s LISTENDisplay CSV file as aligned columns using comma as field separator
cat data.csv | column -t -s,