Skip to content
Tutorials Center
My learning

Topics

Linux Command Reference ยท Text Processing

Linux column command

Reference for the Linux column command: align text into a table with -t, set the separator with -s, fill columns, and the differences between versions.

column arranges text into columns. Its best-known use is column -t, which reads whitespace-separated fields and pads them into an aligned table. Without -t it fills a list of items across the terminal width, like ls does.

column comes from the util-linux package on most distributions (older systems shipped a BSD version in bsdmainutils), and it may be missing from minimal images, including the one that runs this site's examples. The examples below are therefore read-only; the equivalent printf and awk forms that do run are shown after them.

Terminal
column [OPTION]... [FILE]...

Try it

Bash Aligned table without column (runs here)

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with read or cat), it gets the next line from this box.

Bash Use the real column if present

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with read or cat), it gets the next line from this box.

Syntax

Terminal
column [-t] [-s SEPS] [-o OUTSEP] [-c WIDTH] [-x] [-n] [-N NAMES] [FILE]...
Terminal
# Read-only examples
printf 'a,bb,ccc\n1,22,333\n' | column -t -s,
ls | column -c 60
Option Description
-t Table mode: create a table from the input fields, one row per input line.
-s CHARS Characters that separate input fields (default: whitespace). In table mode each character is a delimiter.
-o STRING Output separator between columns in table mode (default two spaces).
-c N Output width in characters; default is the terminal width.
-x Fill rows before columns (default is columns before rows).
-N NAMES, -R util-linux: set column names and right-align columns.
-n util-linux: do not merge adjacent delimiters.
-J util-linux: print the table as JSON (needs -N).

Returns: 0 on success, non-zero on error.

Usage notes

  • Empty fields are merged in table mode when the separator is a whitespace character, because adjacent delimiters count as one. With -s,, two commas in a row still collapse into one on older versions: use -n on util-linux, or fill empty cells with a placeholder such as -.
  • The last column is not padded, so no trailing spaces appear.
  • Differences between versions: the BSD column lacks -N, -J and -n. The util-linux one (2.23+) has them. Check column --version, or fall back to awk or printf for portable scripts.
  • Wide characters and escape codes (colors) break alignment, because column counts characters, not display width. Strip colors with sed before columnizing.
  • Not CSV-aware: quoted fields containing separators are split anyway. Use a real CSV tool for those.
  • Typical use: align command output for humans, as in mount | column -t. Do not feed aligned output back into scripts; use a proper delimiter instead.
  • Header row: column has no concept of a header, so combine it with sort carefully (sort the body, then add the header).