column Command Explained: Making Terminal Output Readable
Terminal output is frequently ragged: one field is long, the next is short, and reading down a column is impossible. column fixes that in one step, and a surprising number of people have never used it.
Table mode
cut -d: -f1,3,6 /etc/passwd | head | column -t -s:
root 0 /root
daemon 1 /usr/sbin
bin 2 /bin
sync 4 /sbin
-t creates a table. -s sets the input separator. That combination covers most use.
The everyday cases
# mount output, which is otherwise a wall of text
mount | column -t
# df, aligned properly with long device names
df -h | column -t
# A CSV
column -t -s, -n data.csv
# Your own pipeline output
awk '{print $1, $9, $10}' access.log | column -t
The -n flag with CSV matters. Without it, consecutive separators are merged, so an empty field between two commas disappears and every subsequent column shifts left by one. That produces a table that looks fine and is wrong.
Fill mode
Without -t, column fills the terminal width like ls does:
ls /usr/bin | column
seq 1 40 | column
Useful for turning a long single-column list into something that fits on screen. Our seq guide covers generating those sequences.
Combining with other tools
The pattern that comes up constantly:
kubectl get pods -o json \
| jq -r '.items[] | [.metadata.name, .status.phase] | @tsv' \
| column -t -s "$(printf '\t')"
Our jq guide covers the @tsv formatter, which exists precisely so its output can be handed to something like this.
du -sh /var/* 2>/dev/null | sort -rh | column -t
When it misaligns
Two causes, both worth knowing.
Colour codes. Escape sequences are characters that occupy no display width, so column counts them and pads wrongly. Strip them first with sed before aligning.
Wide characters. CJK text and some emoji occupy two terminal cells per character. column counts characters, so those rows come out short.
Alternatives
printf in a loop gives exact control when you need specific widths, and awk can format directly with its own printf. For anything scripted where the output shape must be stable, those are more predictable.
column is for the interactive case where you want it readable right now, which is most of the time.
Frequently Asked Questions
What does column do?
It aligns input into columns. In table mode it treats each line as a row and pads fields so they line up, turning ragged output from cut, awk, or a CSV into something readable.
What is the difference between table mode and the default?
Without -t, column fills the terminal width with input items flowing down and across, like ls does. With -t it creates a table, one input line per row, with fields aligned. Table mode is what people almost always want.
How do I use it with CSV files?
Set the separator with -s and a comma. Add -n so consecutive separators are not merged, which matters for CSV where an empty field between two commas is meaningful and would otherwise disappear.
Can column produce a header row?
Yes, with -N to name columns on util-linux versions that support it. The simplest approach is often to include the header in the input and let it align with everything else.
Why do my columns misalign with certain characters?
Because column counts characters rather than display width, so wide CJK characters and some emoji occupy more terminal cells than it accounts for. Colour escape sequences cause the same problem and should be stripped before aligning.
Is column available everywhere?
It ships with util-linux on most distributions, though minimal container images often omit it. The BSD version on macOS has fewer options, so scripts using the newer flags may not be portable.