1SORT(1) User Commands SORT(1)
2
3
4
6 sort - sort lines of text files
7
9 sort [OPTION]... [FILE]...
10 sort [OPTION]... --files0-from=F
11
13 Write sorted concatenation of all FILE(s) to standard output.
14
15 Mandatory arguments to long options are mandatory for short options
16 too. Ordering options:
17
18 -b, --ignore-leading-blanks
19 ignore leading blanks
20
21 -d, --dictionary-order
22 consider only blanks and alphanumeric characters
23
24 -f, --ignore-case
25 fold lower case to upper case characters
26
27 -g, --general-numeric-sort
28 compare according to general numerical value
29
30 -i, --ignore-nonprinting
31 consider only printable characters
32
33 -M, --month-sort
34 compare (unknown) < 'JAN' < ... < 'DEC'
35
36 -h, --human-numeric-sort
37 compare human readable numbers (e.g., 2K 1G)
38
39 -n, --numeric-sort
40 compare according to string numerical value
41
42 -R, --random-sort
43 sort by random hash of keys
44
45 --random-source=FILE
46 get random bytes from FILE
47
48 -r, --reverse
49 reverse the result of comparisons
50
51 --sort=WORD
52 sort according to WORD: general-numeric -g, human-numeric -h,
53 month -M, numeric -n, random -R, version -V
54
55 -V, --version-sort
56 natural sort of (version) numbers within text
57
58 Other options:
59
60 --batch-size=NMERGE
61 merge at most NMERGE inputs at once; for more use temp files
62
63 -c, --check, --check=diagnose-first
64 check for sorted input; do not sort
65
66 -C, --check=quiet, --check=silent
67 like -c, but do not report first bad line
68
69 --compress-program=PROG
70 compress temporaries with PROG; decompress them with PROG -d
71
72 --debug
73 annotate the part of the line used to sort, and warn about ques‐
74 tionable usage to stderr
75
76 --files0-from=F
77 read input from the files specified by NUL-terminated names in
78 file F; If F is - then read names from standard input
79
80 -k, --key=KEYDEF
81 sort via a key; KEYDEF gives location and type
82
83 -m, --merge
84 merge already sorted files; do not sort
85
86 -o, --output=FILE
87 write result to FILE instead of standard output
88
89 -s, --stable
90 stabilize sort by disabling last-resort comparison
91
92 -S, --buffer-size=SIZE
93 use SIZE for main memory buffer
94
95 -t, --field-separator=SEP
96 use SEP instead of non-blank to blank transition
97
98 -T, --temporary-directory=DIR
99 use DIR for temporaries, not $TMPDIR or /tmp; multiple options
100 specify multiple directories
101
102 --parallel=N
103 change the number of sorts run concurrently to N
104
105 -u, --unique
106 with -c, check for strict ordering; without -c, output only the
107 first of an equal run
108
109 -z, --zero-terminated
110 end lines with 0 byte, not newline
111
112 --help display this help and exit
113
114 --version
115 output version information and exit
116
117 KEYDEF is F[.C][OPTS][,F[.C][OPTS]] for start and stop position, where
118 F is a field number and C a character position in the field; both are
119 origin 1, and the stop position defaults to the line's end. If neither
120 -t nor -b is in effect, characters in a field are counted from the
121 beginning of the preceding whitespace. OPTS is one or more single-let‐
122 ter ordering options [bdfgiMhnRrV], which override global ordering
123 options for that key. If no key is given, use the entire line as the
124 key.
125
126 SIZE may be followed by the following multiplicative suffixes: % 1% of
127 memory, b 1, K 1024 (default), and so on for M, G, T, P, E, Z, Y.
128
129 With no FILE, or when FILE is -, read standard input.
130
131 *** WARNING *** The locale specified by the environment affects sort
132 order. Set LC_ALL=C to get the traditional sort order that uses native
133 byte values.
134
135 GNU coreutils online help: <http://www.gnu.org/software/coreutils/>
136 Report sort translation bugs to <http://translationproject.org/team/>
137
139 Written by Mike Haertel and Paul Eggert.
140
142 Copyright © 2013 Free Software Foundation, Inc. License GPLv3+: GNU
143 GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
144 This is free software: you are free to change and redistribute it.
145 There is NO WARRANTY, to the extent permitted by law.
146
148 uniq(1)
149
150 The full documentation for sort is maintained as a Texinfo manual. If
151 the info and sort programs are properly installed at your site, the
152 command
153
154 info coreutils 'sort invocation'
155
156 should give you access to the complete manual.
157
158
159
160GNU coreutils 8.22 October 2018 SORT(1)