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 to use logical column
48 names on command line, but keep the header hidden when print the
49 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 is allowed to truncate text when neces‐
75 sary, otherwise very long table entries may be printed on multi‐
76 ple lines.
77
78 -E, --table-noextreme columns
79 Specify columns where is possible to ignore unusually long
80 (longer than average) cells when calculate column width. The
81 option has impact to the width calculation and table formatting,
82 but the printed text is not affected.
83
84 The option is used for the last visible column by default.
85
86
87 -e, --table-header-repeat
88 Print header line for each page.
89
90 -W, --table-wrap columns
91 Specify columns where is possible to use multi-line cell for
92 long text when necessary.
93
94 -H, --table-hide columns
95 Don't print specified columns. The special placeholder '-' may
96 be used to hide all unnamed columns (see --table-columns).
97
98 -O, --table-order columns
99 Specify columns order on output.
100
101 -n, --table-name name
102 Specify the table name used for JSON output. The default is "ta‐
103 ble".
104
105 -L, --table-empty-lines
106 Insert empty line to the table for each empty line on input. The
107 default is ignore empty lines at all.
108
109 -r, --tree column
110 Specify column to use tree-like output. Note that the circular
111 dependencies and another anomalies in child and parent relation
112 are silently ignored.
113
114 -i, --tree-id column
115 Specify column with line ID to create child-parent relation.
116
117 -p, --tree-parent column
118 Specify column with parent ID to create child-parent relation.
119
120 -x, --fillrows
121 Fill rows before filling columns.
122
123 -V, --version
124 Display version information and exit.
125
126 -h, --help
127 Display help text and exit.
128
130 The environment variable COLUMNS is used to determine the size of the
131 screen if no other information is available.
132
134 Print fstab with header line and align number to the right:
135 sed 's/#.*//' /etc/fstab | column --table --table-columns SOURCE,TARGET,TYPE,OPTIONS,PASS,FREQ --table-right PASS,FREQ
136
137 Print fstab and hide unnamed columns:
138 sed 's/#.*//' /etc/fstab | column --table --table-columns SOURCE,TARGET,TYPE --table-hide -
139
140 Print a tree:
141 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
142 1 0 A
143 2 1 |-AA
144 4 2 | |-AAA
145 5 2 | `-AAB
146 3 1 `-AB
147
149 Version 2.23 changed the -s option to be non-greedy, for example:
150
151 printf "a:b:c\n1::3\n" | column -t -s ':'
152
153 Old output:
154 a b c
155 1 3
156
157 New output (since util-linux 2.23):
158 a b c
159 1 3
160
161 Historical versions of this tool indicated that "rows are filled before
162 columns" by default, and that the -x option reverses this. This wording
163 did not reflect the actual behavior, and it has since been corrected
164 (see above). Other implementations of column may continue to use the
165 older documentation, but the behavior should be identical in any case.
166
168 colrm(1), ls(1), paste(1), sort(1)
169
171 The column command appeared in 4.3BSD-Reno.
172
174 The column command is part of the util-linux package and is available
175 from https://www.kernel.org/pub/linux/utils/util-linux/.
176
177
178
179util-linux February 2019 COLUMN(1)