Skip to content
shellmap

columnAlign text output into columns in bash, zsh, fish, PowerShell, and cmd across all 5 shells

Equivalents in every shell

Bashunix
column -t -s, file.csv

BSD/GNU external. `-t` enables table mode (auto-align columns). `-s` sets the input separator (default: whitespace). `-o` sets the OUTPUT separator (GNU only). `-N "Col1,Col2,Col3"` adds headers (util-linux 2.30+). Reads stdin if no file. Good for ad-hoc CSV inspection; doesn't handle quoted fields with embedded commas (RFC 4180).

Zshunix
column -t -s, file.csv

Same external. macOS BSD `column` has FEWER flags than GNU — no `-N` (named headers), no `-o` (output separator). For full feature parity on macOS, `brew install util-linux` and call `/opt/homebrew/opt/util-linux/bin/column`.

Fishunix
column -t -s, file.csv

Same external. Fish-friendly pattern: `string split0 \n file.csv | column -t -s,` — but generally fish users prefer `string split` + manual formatting for column work since fish 3.6+'s `string` builtin is more powerful than `column` for one-off splits.

PowerShellwindows
Import-Csv file.csv | Format-Table -AutoSize

pwsh has NO `column` cmdlet because object-table-formatting is core. `Format-Table -AutoSize` auto-widths columns; `Format-Table -Wrap` wraps long fields. For inline CSV: `Import-Csv` parses RFC 4180 (handling quoted-field-with-embedded-commas correctly — `column -t` does NOT). For unstructured text: `$lines | ConvertFrom-Csv -Delimiter ","| Format-Table` for one-liner workflows.

cmd.exewindows
rem No native equivalent — shell out to PowerShell

cmd has no `column` equivalent. The standard workaround is `powershell -Command "Import-Csv file.csv | Format-Table -AutoSize"`. For raw whitespace-aligned output without CSV parsing, `for /f` loops with manual padding via `set "x= %name%"` substring tricks are the only pure-cmd option — verbose and fragile.

Worked examples

Pretty-print a CSV file aligned by columns

Bash
column -t -s, file.csv
Fish
column -t -s, file.csv
PowerShell
Import-Csv file.csv | Format-Table -AutoSize

Align whitespace-separated output (`ps`, `df`)

Bash
df -h | column -t
Fish
df -h | column -t
PowerShell
Get-PSDrive | Format-Table Name, Used, Free -AutoSize

CSV with quoted fields containing commas

Bash
# column -t -s, breaks on quoted commas — use Python instead
python3 -c "import csv,sys; [print(*r,sep=\"\t\") for r in csv.reader(sys.stdin)]" < file.csv | column -t -s$'\t'
PowerShell
Import-Csv file.csv | Format-Table -AutoSize  # handles quoted-comma correctly

Gotchas

  • BSD `column` (macOS, BSDs) is MISSING flags that scripts often rely on — `-N` (headers), `-o` (output separator), `-J` (JSON output, util-linux 2.36+). Cross-platform scripts that use these flags fail silently on macOS with `column: unknown option -- N`. Test on macOS or detect and fall back.
  • BSD/macOS `column -t -s,` does NOT handle CSV with quoted-fields-containing-commas (e.g. `"Smith, John",30,NYC`) — it treats every comma as a separator, mangling the row. For correct CSV parsing, use Python `csv` module, `awk -v FPAT="..."` (gawk), or pwsh `Import-Csv` (RFC 4180-compliant).
  • pwsh `Format-Table -AutoSize` reads ALL input before sizing columns — for streaming infinite input, `-AutoSize` hangs forever. Use bounded width (`Format-Table @{Expression=...; Width=20}, @{...}`) for streaming workflows.
  • cmd has no `column` and the `for /f` workaround can't handle multi-character separators or quoted fields. For CSV alignment in cmd, the only practical option is `powershell -Command "Import-Csv X | Format-Table -AutoSize"` — accept the dependency on pwsh.
  • `column -t` interprets the input as one row per line. Lines that wrap or are wrapped externally (e.g. ssh terminal width truncation) break the alignment. Pre-process with `tr` or `awk` to ensure one logical row per line before piping.

WSL & PowerShell Core notes

pwshpwsh `Format-Table` is the cross-OS alternative — works on Windows / Linux / macOS pwsh identically. For exact `column -t` parity (whitespace-aligned text-mode output, no CSV semantics), pwsh has no exact equivalent; `Format-Table` always interprets input as objects with named columns.
WSLWSL bash `column -t` works as on Linux. To pretty-print Windows-side CSV from WSL: `column -t -s, /mnt/c/Users/me/data.csv` works for simple CSV; for quoted-comma files, route through WSL Python or pwsh.exe.

Related commands