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