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 '-' maybe
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 defaout is "ta‐
103 ble".
104
105 -r, --tree column
106 Specify column to use tree-like output. Note that the circular
107 dependencies and another anomalies in child and parent relation
108 are silently ignored.
109
110 -i, --tree-id column
111 Specify column with line ID to create child-parent relation.
112
113 -p, --tree-parent column
114 Specify column with parent ID to create child-parent relation.
115
116 -x, --fillrows
117 Fill rows before filling columns.
118
119 -V, --version
120 Display version information and exit.
121
122 -h, --help
123 Display help text and exit.
124
126 The environment variable COLUMNS is used to determine the size of the
127 screen if no other information is available.
128
130 Print fstab with header line and align number to the right:
131 sed 's/#.*//' /etc/fstab | column --table --table-columns SOURCE,TARGET,TYPE,OPTIONS,PASS,FREQ --table-right PASS,FREQ
132
133 Print fstab and hide unnamed columns:
134 sed 's/#.*//' /etc/fstab | column --table --table-columns SOURCE,TARGET,TYPE --table-hide -
135
136 Print a tree:
137 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
138 1 0 A
139 2 1 |-AA
140 4 2 | |-AAA
141 5 2 | `-AAB
142 3 1 `-AB
143
145 Version 2.23 changed the -s option to be non-greedy, for example:
146
147 printf "a:b:c\n1::3\n" | column -t -s ':'
148
149 Old output:
150 a b c
151 1 3
152
153 New output (since util-linux 2.23):
154 a b c
155 1 3
156
158 colrm(1), ls(1), paste(1), sort(1)
159
161 The column command appeared in 4.3BSD-Reno.
162
164 The column command is part of the util-linux package and is available
165 from https://www.kernel.org/pub/linux/utils/util-linux/.
166
167
168
169util-linux January 2017 COLUMN(1)