LS(1) LS(1)
NAME
colm - columnate lines of text
SYNOPSIS
colm [ -cglnstvwLT ] name ...
DESCRIPTION
colm produces multi-column output from single-column input. It is
sort of a cross between pr -<n> (which prints multi-column output
sorted across) and the column-sorting function of ls (1) (which sorts
down, but only if given no filename arguments). It can produce fixed
or variable width columns, and it figures out any options not
explicitly specified.
colm uses getopt(3C) to parse its options, so options may be strung
together, as in -vw, and values may either adhere to their option
letters or follow as the next argument. The options are as follows:
-v Produce variable-width columns. colm uses an iterative algorithm
to find the maximum number of columns that allows at least the
gutter-width between the widest element and the next column. The
-v option is incompatible with -c.
-cn Use fixed-width columns of width n. Data will be truncated if
necessary to fit the specified column width. If -c is not used,
colm expands the column width(s) to fit the output width.
-gn Use a "gutter" of n characters between columns. The default is
1.
-nn Use n fixed-width columns. Without -n, colm fits as many columns
in the given output width as it can.
-s Spread the columns to fit the output width. Otherwise columns
are made as narrow as possible, while leaving the gutter space
between columns. With fixed-width columns, the columns will be
spread as far as possible while keeping their widths even. WIth
variable-width columns, the columns will be spread so that there
is an even amount of white space between them.
-wn Sets the output width to n characters. The output lines may be
shorter, but cannot be longer than n.
-ln Sets the page length to n lines. This option is not implemented.
An error message will result if you try to use it.
-Lc Sets the leader character to c. This character is used
repeatedly to fill in the space between columns. The default is
to use as many spaces and tabs as are needed. -L ' ' will cause
colm not to use tabs. Watch out for shell metacharacters.
- 1 - Formatted: November 5, 2025
LS(1) LS(1)
-ts Use the literal string "s" to separate the columns, rather than a
repeated leader character. Watch out for shell metacharacters.
There are two main differences between -L and -t: -L only allows
a single character, while -t allows a string; and the leader
character specified by -L is repeated to fill the space, whereas
the string specified with -t is used only once between columns.
Generally, -t will not produce even columns, while -L always
will.
-Tn Specifies the output tab width as n characters. The default is
eight.
DIAGNOSTICS
Several errors and warnings can be produced by colm:
A usage message is produced for illegal options.
If any single input line is longer than the output width, colm
terminates with an error.
Illegal combinations of arguments and impossible conditions, such as
20 columns of 30 characters in an output width of 79 columns, or
selecting spreading with a fixed separator string, cause errors.
Certain combinations of total number of lines and specified number of
columns cannot produce balanced columns, even with the last column
allowed to be short. If this occurs, colm prints an explanatory
message on stderr and uses a smaller number of columns than were
specified.
Attempting to do multi-page columnation (with -l) produces an error.
Nonexistent or unreadable files produce an error.
SEE ALSO
pr(1), ls(1)
BUGS
Multi-page columnation is not implemented.
- 2 - Formatted: November 5, 2025