1COLUMN(1) User Commands COLUMN(1)
2
3
4
6 column - columnate lists
7
9 column [options] [file...]
10
12 The column utility formats its input into multiple columns. The util
13 support three modes:
14
15 columns are filled before rows
16 This is the default mode (required by backward compatibility).
17
18 rows are filled before columns
19 This mode is enabled by option -x, --fillrows
20
21 table Determine the number of columns the input contains and create a
22 table. This mode is enabled by option -t, --table and columns
23 formatting is possible to modify by --table-* options. Use this
24 mode if not sure.
25
26 Input is taken from file, or otherwise from standard input. Empty
27 lines are ignored and all invalid multibyte sequences are encoded by
28 \x<hex> convention.
29
31 The argument columns for --table-* options is comma separated list of
32 the column names as defined by --table-columns or it's column number in
33 order as specified by input. It's possible to mix names and numbers.
34
35 -J, --json
36 Use JSON output format to print the table, the option --ta‐
37 ble-columns is required and the option --table-name is recom‐
38 mended.
39
40 -c, --output-width width
41 Output is formatted to a width specified as number of charac‐
42 ters. The original name of this option is --columns; this name
43 is deprecated since v2.30. Note that input longer than width is
44 not truncated by default.
45
46 -d, --table-noheadings
47 Do not print header. This option allows the use of logical col‐
48 umn names on the command line, but keeps the header hidden when
49 printing the table.
50
51 -o, --output-separator string
52 Specify the columns delimiter for table output (default is two
53 spaces).
54
55 -s, --separator separators
56 Specify the possible input item delimiters (default is white‐
57 space).
58
59 -t, --table
60 Determine the number of columns the input contains and create a
61 table. Columns are delimited with whitespace, by default, or
62 with the characters supplied using the --output-separator
63 option. Table output is useful for pretty-printing.
64
65 -N, --table-columns names
66 Specify the columns names by comma separated list of names. The
67 names are used for the table header or to address column in
68 option arguments.
69
70 -R, --table-right columns
71 Right align text in the specified columns.
72
73 -T, --table-truncate columns
74 Specify columns where text can be truncated when necessary, oth‐
75 erwise very long table entries may be printed on multiple lines.
76
77 -E, --table-noextreme columns
78 Specify columns where is possible to ignore unusually long
79 (longer than average) cells when calculate column width. The
80 option has impact to the width calculation and table formatting,
81 but the printed text is not affected.
82
83 The option is used for the last visible column by default.
84
85
86 -e, --table-header-repeat
87 Print header line for each page.
88
89 -W, --table-wrap columns
90 Specify columns where is possible to use multi-line cell for
91 long text when necessary.
92
93 -H, --table-hide columns
94 Don't print specified columns. The special placeholder '-' may
95 be used to hide all unnamed columns (see --table-columns).
96
97 -O, --table-order columns
98 Specify columns order on output.
99
100 -n, --table-name name
101 Specify the table name used for JSON output. The default is "ta‐
102 ble".
103
104 -L, --table-empty-lines
105 Insert empty line to the table for each empty line on input. The
106 default is ignore empty lines at all.
107
108 -r, --tree column
109 Specify column to use tree-like output. Note that the circular
110 dependencies and other anomalies in child and parent relation
111 are silently ignored.
112
113 -i, --tree-id column
114 Specify column with line ID to create child-parent relation.
115
116 -p, --tree-parent column
117 Specify column with parent ID to create child-parent relation.
118
119 -x, --fillrows
120 Fill rows before filling columns.
121
122 -V, --version
123 Display version information and exit.
124
125 -h, --help
126 Display help text and exit.
127
129 The environment variable COLUMNS is used to determine the size of the
130 screen if no other information is available.
131
133 The column command appeared in 4.3BSD-Reno.
134
136 Version 2.23 changed the -s option to be non-greedy, for example:
137
138 printf "a:b:c\n1::3\n" | column -t -s ':'
139
140 Old output:
141 a b c
142 1 3
143
144 New output (since util-linux 2.23):
145 a b c
146 1 3
147
148 Historical versions of this tool indicated that "rows are filled before
149 columns" by default, and that the -x option reverses this. This wording
150 did not reflect the actual behavior, and it has since been corrected
151 (see above). Other implementations of column may continue to use the
152 older documentation, but the behavior should be identical in any case.
153
155 Print fstab with header line and align number to the right:
156 sed 's/#.*//' /etc/fstab | column --table --table-columns SOURCE,TARGET,TYPE,OPTIONS,PASS,FREQ --table-right PASS,FREQ
157
158 Print fstab and hide unnamed columns:
159 sed 's/#.*//' /etc/fstab | column --table --table-columns SOURCE,TARGET,TYPE --table-hide -
160
161 Print a tree:
162 echo -e '1 0 A\n2 1 AA\n3 1 AB\n4 2 AAA\n5 2 AAB' | column --tree-id 1 --tree-parent 2 --tree 3
163 1 0 A
164 2 1 |-AA
165 4 2 | |-AAA
166 5 2 | `-AAB
167 3 1 `-AB
168
170 colrm(1), ls(1), paste(1), sort(1)
171
173 The column command is part of the util-linux package and is available
174 from https://www.kernel.org/pub/linux/utils/util-linux/.
175
176
177
178util-linux February 2019 COLUMN(1)