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 it’s column number in
36 order as specified by input. It’s possible to mix names and numbers.
37 The special placeholder '0' (e.g. -R0) may be used to specify all
38 columns.
39
40 -J, --json
41 Use JSON output format to print the table, the option
42 --table-columns is required and the option --table-name is
43 recommended.
44
45 -c, --output-width width
46 Output is formatted to a width specified as number of characters.
47 The original name of this option is --columns; this name is
48 deprecated since v2.30. Note that input longer than width is not
49 truncated by default. The default is a terminal width and the 80
50 columns in non-interactive mode. The column headers are never
51 truncated.
52
53 -d, --table-noheadings
54 Do not print header. This option allows the use of logical column
55 names on the command line, but keeps the header hidden when
56 printing the table.
57
58 -o, --output-separator string
59 Specify the columns delimiter for table output (default is two
60 spaces).
61
62 -s, --separator separators
63 Specify the possible input item delimiters (default is whitespace).
64
65 -t, --table
66 Determine the number of columns the input contains and create a
67 table. Columns are delimited with whitespace, by default, or with
68 the characters supplied using the --output-separator option. Table
69 output is useful for pretty-printing.
70
71 -N, --table-columns names
72 Specify the columns names by comma separated list of names. The
73 names are used for the table header or to address column in option
74 arguments.
75
76 -l, --table-columns-limit number
77 Specify maximal number of the input columns. The last column will
78 contain all remaining line data if the limit is smaller than the
79 number of the columns in the input data.
80
81 -R, --table-right columns
82 Right align text in the specified columns.
83
84 -T, --table-truncate columns
85 Specify columns where text can be truncated when necessary,
86 otherwise very long table entries may be printed on multiple lines.
87
88 -E, --table-noextreme columns
89 Specify columns where is possible to ignore unusually long (longer
90 than average) cells when calculate column width. The option has
91 impact to the width calculation and table formatting, but the
92 printed text is not affected.
93
94 The option is used for the last visible column by default.
95
96 -e, --table-header-repeat
97 Print header line for each page.
98
99 -W, --table-wrap columns
100 Specify columns where is possible to use multi-line cell for long
101 text when necessary.
102
103 -H, --table-hide columns
104 Don’t print specified columns. The special placeholder '-' may be
105 used to hide all unnamed columns (see --table-columns).
106
107 -O, --table-order columns
108 Specify columns order on output.
109
110 -n, --table-name name
111 Specify the table name used for JSON output. The default is
112 "table".
113
114 -L, --keep-empty-lines
115 Preserve whitespace-only lines in the input. The default is ignore
116 empty lines at all. This option’s original name was
117 --table-empty-lines but is now deprecated because it gives the
118 false impression that the option only applies to table mode.
119
120 -r, --tree column
121 Specify column to use tree-like output. Note that the circular
122 dependencies and other anomalies in child and parent relation are
123 silently ignored.
124
125 -i, --tree-id column
126 Specify column with line ID to create child-parent relation.
127
128 -p, --tree-parent column
129 Specify column with parent ID to create child-parent relation.
130
131 -x, --fillrows
132 Fill rows before filling columns.
133
134 -h, --help
135 Display help text and exit.
136
137 -V, --version
138 Print version and exit.
139
141 The environment variable COLUMNS is used to determine the size of the
142 screen if no other information is available.
143
145 The column command appeared in 4.3BSD-Reno.
146
148 Version 2.23 changed the -s option to be non-greedy, for example:
149
150 printf "a:b:c\n1::3\n" | column -t -s ':'
151
152 Old output:
153
154 a b c
155 1 3
156
157 New output (since util-linux 2.23):
158
159 a b c
160 1 3
161
162 Historical versions of this tool indicated that "rows are filled before
163 columns" by default, and that the -x option reverses this. This wording
164 did not reflect the actual behavior, and it has since been corrected
165 (see above). Other implementations of column may continue to use the
166 older documentation, but the behavior should be identical in any case.
167
169 Print fstab with header line and align number to the right:
170
171 sed 's/#.*//' /etc/fstab | column --table --table-columns SOURCE,TARGET,TYPE,OPTIONS,PASS,FREQ --table-right PASS,FREQ
172
173 Print fstab and hide unnamed columns:
174
175 sed 's/#.*//' /etc/fstab | column --table --table-columns SOURCE,TARGET,TYPE --table-hide -
176
177 Print a tree:
178
179 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
180 1 0 A
181 2 1 |-AA
182 4 2 | |-AAA
183 5 2 | `-AAB
184 3 1 `-AB
185
187 colrm(1), ls(1), paste(1), sort(1)
188
190 For bug reports, use the issue tracker at
191 https://github.com/util-linux/util-linux/issues.
192
194 The column command is part of the util-linux package which can be
195 downloaded from Linux Kernel Archive
196 <https://www.kernel.org/pub/linux/utils/util-linux/>.
197
198
199
200util-linux 2.38.1 2022-08-04 COLUMN(1)