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
22 Determine the number of columns the input contains and create a
23 table. This mode is enabled by option -t, --table and columns
24 formatting is possible to modify by --table-* options. Use this
25 mode if not sure. The output is aligned to the terminal width in
26 interactive mode and the 80 columns in non-interactive mode (see
27 --output-width for more details).
28
29 Input is taken from file, or otherwise from standard input. Empty lines
30 are ignored and all invalid multibyte sequences are encoded by x<hex>
31 convention.
32
34 The argument columns for --table-* options is a comma separated list of
35 the column names as defined by --table-columns, or names defined by
36 --table-column or it’s column number in order as specified by input.
37 It’s possible to mix names and numbers. The special placeholder '0'
38 (e.g. -R0) may be used to specify all columns and '-1' (e.g. -R -1) to
39 specify the last visible column. It’s possible to use ranges like '1-5'
40 when addressing columns by numbers.
41
42 -J, --json
43 Use JSON output format to print the table, the option
44 --table-columns is required and the option --table-name is
45 recommended.
46
47 -c, --output-width width
48 Output is formatted to a width specified as number of characters.
49 The original name of this option is --columns; this name is
50 deprecated since v2.30. Note that input longer than width is not
51 truncated by default. The default is a terminal width and the 80
52 columns in non-interactive mode. The column headers are never
53 truncated.
54
55 The placeholder "unlimited" (or 0) is possible to use to not
56 restrict output width. This is recommended for example when output
57 to the files rather than on terminal.
58
59 -d, --table-noheadings
60 Do not print header. This option allows the use of logical column
61 names on the command line, but keeps the header hidden when
62 printing the table.
63
64 -o, --output-separator string
65 Specify the columns delimiter for table output (default is two
66 spaces).
67
68 -s, --separator separators
69 Specify the possible input item delimiters (default is whitespace).
70
71 -t, --table
72 Determine the number of columns the input contains and create a
73 table. Columns are delimited with whitespace, by default, or with
74 the characters supplied using the --output-separator option. Table
75 output is useful for pretty-printing.
76
77 -C, --table-column properties
78 Define one column by comma separated list of column attributes.
79 This option can be used more than once, every use defines just one
80 column. The properties replace some of --table- options. For
81 example --table-column name=FOO,right define one column where text
82 is aligned to right. The option is mutually exclusive to
83 --table-columns.
84
85 The currently supported attributes are:
86
87 name=string
88 Specifies column name.
89
90 trunc
91 The column text can be truncated when necessary. The same as
92 --table-truncate.
93
94 right
95 Right align text in the specified columns. The same as
96 --table-right.
97
98 width=number
99 Specifies column width. The width is used as a hint only. The
100 width is strictly followed only when strictwidth attribute is
101 used too.
102
103 strictwidth
104 Strictly follow column width= setting.
105
106 noextreme
107 Specify columns where is possible to ignore unusually long
108 cells. See --table-noextreme for more details.
109
110 wrap
111 Specify columns where is possible to use multi-line cell for
112 long text when necessary. See --table-wrap.
113
114 hide
115 Don’t print specified columns. See --table-hide.
116
117 json=type
118 Define column type for JSON output, Supported are string,
119 number and boolean.
120
121 -N, --table-columns names
122 Specify the columns names by comma separated list of names. The
123 names are used for the table header or to address column in option
124 argument. See also --table-column.
125
126 -l, --table-columns-limit number
127 Specify maximal number of the input columns. The last column will
128 contain all remaining line data if the limit is smaller than the
129 number of the columns in the input data.
130
131 -R, --table-right columns
132 Right align text in the specified columns.
133
134 -T, --table-truncate columns
135 Specify columns where text can be truncated when necessary,
136 otherwise very long table entries may be printed on multiple lines.
137
138 -E, --table-noextreme columns
139 Specify columns where is possible to ignore unusually long (longer
140 than average) cells when calculate column width. The option has
141 impact to the width calculation and table formatting, but the
142 printed text is not affected.
143
144 The option is used for the last visible column by default.
145
146 -e, --table-header-repeat
147 Print header line for each page.
148
149 -W, --table-wrap columns
150 Specify columns where is possible to use multi-line cell for long
151 text when necessary.
152
153 -H, --table-hide columns
154 Don’t print specified columns. The special placeholder '-' may be
155 used to hide all unnamed columns (see --table-columns).
156
157 -O, --table-order columns
158 Specify columns order on output.
159
160 -n, --table-name name
161 Specify the table name used for JSON output. The default is
162 "table".
163
164 -m, --table-maxout
165 Fill all available space on output.
166
167 -L, --keep-empty-lines
168 Preserve whitespace-only lines in the input. The default is ignore
169 empty lines at all. This option’s original name was
170 --table-empty-lines but is now deprecated because it gives the
171 false impression that the option only applies to table mode.
172
173 -r, --tree column
174 Specify column to use tree-like output. Note that the circular
175 dependencies and other anomalies in child and parent relation are
176 silently ignored.
177
178 -i, --tree-id column
179 Specify column with line ID to create child-parent relation.
180
181 -p, --tree-parent column
182 Specify column with parent ID to create child-parent relation.
183
184 -x, --fillrows
185 Fill rows before filling columns.
186
187 -h, --help
188 Display help text and exit.
189
190 -V, --version
191 Print version and exit.
192
194 The environment variable COLUMNS is used to determine the size of the
195 screen if no other information is available.
196
198 The column command appeared in 4.3BSD-Reno.
199
201 Version 2.23 changed the -s option to be non-greedy, for example:
202
203 printf "a:b:c\n1::3\n" | column -t -s ':'
204
205 Old output:
206
207 a b c
208 1 3
209
210 New output (since util-linux 2.23):
211
212 a b c
213 1 3
214
215 Historical versions of this tool indicated that "rows are filled before
216 columns" by default, and that the -x option reverses this. This wording
217 did not reflect the actual behavior, and it has since been corrected
218 (see above). Other implementations of column may continue to use the
219 older documentation, but the behavior should be identical in any case.
220
222 Print fstab with header line and align number to the right:
223
224 sed 's/#.*//' /etc/fstab | column --table --table-columns SOURCE,TARGET,TYPE,OPTIONS,PASS,FREQ --table-right PASS,FREQ
225
226 Print fstab and hide unnamed columns:
227
228 sed 's/#.*//' /etc/fstab | column --table --table-columns SOURCE,TARGET,TYPE --table-hide -
229
230 Print a tree:
231
232 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
233 1 0 A
234 2 1 |-AA
235 4 2 | |-AAA
236 5 2 | `-AAB
237 3 1 `-AB
238
240 colrm(1), ls(1), paste(1), sort(1)
241
243 For bug reports, use the issue tracker at
244 https://github.com/util-linux/util-linux/issues.
245
247 The column command is part of the util-linux package which can be
248 downloaded from Linux Kernel Archive
249 <https://www.kernel.org/pub/linux/utils/util-linux/>.
250
251
252
253util-linux 2.39.2 2023-06-14 COLUMN(1)