Linux column Command: Format Text as a Table

column arranges uneven text into columns that are easy to read. util-linux's column -t adjusts the width of separated fields to create a table that is easy to read in the terminal.

This is a command that changes the display format, not a parser that structurally validates data. The output width, line wrapping of long values, and color handling may vary depending on the version of util-linux. If the command is not available, a separate package may need to be installed.

Basic syntax

column [option] [file...]

The installed implementation and options may vary depending on the distribution. Check the description for your current system with man column.

Examples

Aligning space-separated tables

It calculates the field width to align columns.

column -t packages.txt

Colon-separated input

Specify the input delimiter with -s and create a table format with -t.

column -s ':' -t /etc/passwd

Command Output Formatting

Displays the results received from standard input in a way that is easy to read on the terminal.

printf 'name score\nkim 90\nlee 85\n' | column -t

Checking Table Format Output

column -t calculates the width of input columns and aligns them with spaces. The following example sorts two space-separated columns.

printf 'NAME AGE\nAna 7\nBenjamin 12\n' | column -t

Example output (the number of spaces may vary depending on the implementation):

NAME      AGE
Ana       7
Benjamin  12

The display is easy for humans to read, but it is not a format for safely exporting structured data. If a script needs to re-parse the columns, maintain a clear delimiter format such as tabs, CSV, or JSON instead of relying on space-aligned results. The range of options supported by column may vary depending on the distribution.

Main Options and Format

Options/Format Description
-t Formats the input as a table.
-s delimiter Specifies the delimiter of the input fields.
-o delimiter Specifies the delimiter between output columns.
-x Changes the default column filling direction to row-first.

Precautions when using

Even if the numbers appear aligned, do not trust this as a data exchange format. The output can vary depending on the terminal width or version. Complex formats like CSV quoting rules do not fit this simple example.

Frequently Asked Questions

What to do if you get a message that the column command is not found?

Check whether the package that provides column from util-linux is installed on your distribution. The package name may vary depending on the distribution.

Official Documentation

For the exact behavior of the options and implementation differences, refer to the official documentation for column.