A command-line tool for formatting text into readable columns with automatic wrapping.
columns takes tabular text input and formats it nicely within a specified width. It can auto-detect columns from whitespace or use explicit separators. Long text wraps within columns instead of getting truncated, so you can actually read those annoyingly wide command outputs.
Useful for making wide terminal output readable, formatting tables, or just making data look nice.
Basic usage:
# Auto-detect columns and use terminal width
columns input.txt
# Specify width
columns --width 100 input.txt
# Use a specific separator (tab, comma, semicolon, etc.)
columns -s $'\t' data.tsv
columns -s ',' data.csv
# Read from stdin
docker ps | columns --width 120The tool looks for runs of 2+ spaces (configurable with --column-spacing) to detect column boundaries.
# Terminal with 160 width [looks nice]
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
647650d0a017 ubuntu "/bin/bash" 3 hours ago Up 3 hours 0.0.0.0:32768->1090/tcp, [::]:32768->1090/tcp stupefied_bardeen
ca451888695b vsc-columns-86a01c23e-uid "/bin/sh -c 'echo Co…" 7 days ago Up 8 hours ecstatic_napier
# Terminal with 110 width [wraps awkwardly]
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS
NAMES
647650d0a017 ubuntu "/bin/bash" 3 hours ago Up 3 hours 0.0.0.0:32768->
1090/tcp, [::]:32768->1090/tcp stupefied_bardeen
ca451888695b vsc-columns-86a01c23e-uid "/bin/sh -c 'echo Co…" 7 days ago Up 8 hours
ecstatic_napier
# Terminal with 110 width | columns [wraps better]
$ docker ps | columns
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
647650d0a017 ubuntu "/bin/bash" 3 hours Up 3 0.0.0.0: stupefied_bardeen
ago hours 32768->1090/tcp,
[::]:
32768->1090/tcp
ca451888695b vsc-columns-86a01c23e-uid "/bin/sh -c 7 days Up 8 ecstatic_napier
'echo Co…" ago hours # Data (note: Separated with tabs, not spaces)
$ cat data.tsv
Name Age Department Salary Location
John Smith 32 Engineering 95000 San Francisco
Maria Garcia 28 Marketing 72000 New York
David Lee 45 Sales 88000 Chicago
Sarah Johnson 36 Engineering 105000 Seattle
Michael Brown 41 Finance 98000 Boston
# Formatted
$ columns -s $'\t' data.tsv
Name Age Department Salary Location
John Smith 32 Engineering 95000 San Francisco
Maria Garcia 28 Marketing 72000 New York
David Lee 45 Sales 88000 Chicago
Sarah Johnson 36 Engineering 105000 Seattle
Michael Brown 41 Finance 98000 Boston Build from source:
cargo build --releaseThe binary will be at target/release/columns.