column — Tabular Formatting

Format delimited data into aligned columns — the final presentation step before human eyes hit the terminal.

Tabulate Output — -t

Auto-align whitespace-separated output into columns
mount | column -t
Tabulate a colon-delimited file — specify separator with -s
column -t -s':' /etc/passwd
Tabulate comma-separated data
column -t -s',' data.csv
Tabulate pipe-delimited data
echo -e "name|age|city\nalice|30|portland\nbob|25|seattle" | column -t -s'|'
Prettify key-value output from any command
sysctl -a 2>/dev/null | head -20 | column -t -s'='

Custom Separator — -s

Input separator — tells column how to split fields
column -t -s$'\t' data.tsv
Output separator — -o flag sets the string between output columns
column -t -s':' -o'  |  ' /etc/passwd | head -5
Multiple input separators — use any of these characters to split
column -t -s':,' mixed_delimiters.txt

JSON Mode — -J (util-linux 2.30+)

Convert tabular data to JSON
echo -e "name age city\nalice 30 portland\nbob 25 seattle" | column -t -J -N name,age,city
JSON output from a CSV with named columns
column -t -s',' -J -N hostname,ip,role < servers.csv

Named Columns — -N

Name columns for JSON output or documentation
df -h | column -t -N filesystem,size,used,avail,pct,mount

Right-Align and Hide Columns

Right-align specific columns — -R (column numbers, 1-indexed)
echo -e "service count bytes\nnginx 1500 45000\nsshd 200 8000" | column -t -R 2,3
Hide columns — -H (column numbers to suppress)
column -t -s':' -H 2 /etc/passwd | head -5
# Hides column 2 (password field)
Combine named columns with right-alignment
echo -e "name score grade\nalice 98 A\nbob 75 C" | column -t -N name,score,grade -R 2

Prettifying Command Output

Make mount output readable
mount | column -t
Format ss output with aligned columns
ss -tln | column -t
Align environment variables
env | sort | column -t -s'='
Pretty-print a CSV for quick inspection
head -20 report.csv | column -t -s','
Format key-value pairs from a config file
grep -v '^#' /etc/sysctl.conf | grep '=' | column -t -s'='
Align process list with specific fields
ps -eo pid,user,%cpu,%mem,comm --sort=-%cpu | head -15 | column -t

column vs printf vs awk — When to Use Each

column: auto-aligns existing output — no format string needed
# Best when you already have the data and just need alignment
cat data.txt | column -t
printf/awk: precise control over width and formatting
# Best when you need exact column widths or numeric formatting
awk '{printf "%-20s %10d %8.2f\n", $1, $2, $3}' data.txt
column works on full output — awk works per-line during processing
# column needs all lines to compute max widths — buffers entire input
# awk printf uses fixed widths — streams, no buffering

Practical Patterns

Quick CSV viewer — header + separator + data
(head -1 data.csv; echo "---"; tail -n +2 data.csv) | column -t -s','
Tabulate the output of a loop
for f in /var/log/*.log; do echo "$(wc -l < "$f") $(du -h "$f" | cut -f1) $f"; done | column -t
Format paste output into a clean table
paste <(cut -d: -f1 /etc/passwd) <(cut -d: -f3 /etc/passwd) <(cut -d: -f7 /etc/passwd) | column -t
Side-by-side lists — combine paste with column
paste <(seq 5) <(printf '%s\n' a b c d e) | column -t
Wrap long lines into columns — fill terminal width
ls /usr/bin | column
Control number of columns with -c (terminal width in characters)
ls /usr/bin | column -c 80