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 --files0-from=F
73 read input from the files specified by NUL-terminated names in
74 file F; If F is - then read names from standard input
75
76 -k, --key=POS1[,POS2]
77 start a key at POS1 (origin 1), end it at POS2 (default end of
78 line)
79
80 -m, --merge
81 merge already sorted files; do not sort
82
83 -o, --output=FILE
84 write result to FILE instead of standard output
85
86 -s, --stable
87 stabilize sort by disabling last-resort comparison
88
89 -S, --buffer-size=SIZE
90 use SIZE for main memory buffer
91
92 -t, --field-separator=SEP
93 use SEP instead of non-blank to blank transition
94
95 -T, --temporary-directory=DIR
96 use DIR for temporaries, not $TMPDIR or /tmp; multiple options
97 specify multiple directories
98
99 -u, --unique
100 with -c, check for strict ordering; without -c, output only the
101 first of an equal run
102
103 -z, --zero-terminated
104 end lines with 0 byte, not newline
105
106 --help display this help and exit
107
108 --version
109 output version information and exit
110
111 POS is F[.C][OPTS], where F is the field number and C the character
112 position in the field; both are origin 1. If neither -t nor -b is in
113 effect, characters in a field are counted from the beginning of the
114 preceding whitespace. OPTS is one or more single-letter ordering
115 options, which override global ordering options for that key. If no
116 key is given, use the entire line as the key.
117
118 SIZE may be followed by the following multiplicative suffixes: % 1% of
119 memory, b 1, K 1024 (default), and so on for M, G, T, P, E, Z, Y.
120
121 With no FILE, or when FILE is -, read standard input.
122
123 *** WARNING *** The locale specified by the environment affects sort
124 order. Set LC_ALL=C to get the traditional sort order that uses native
125 byte values.
126
128 Written by Mike Haertel and Paul Eggert.
129
131 Report sort bugs to bug-coreutils@gnu.org
132 GNU coreutils home page: <http://www.gnu.org/software/coreutils/>
133 General help using GNU software: <http://www.gnu.org/gethelp/>
134 Report sort translation bugs to <http://translationproject.org/team/>
135
137 Copyright © 2010 Free Software Foundation, Inc. License GPLv3+: GNU
138 GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
139 This is free software: you are free to change and redistribute it.
140 There is NO WARRANTY, to the extent permitted by law.
141
143 The full documentation for sort is maintained as a Texinfo manual. If
144 the info and sort programs are properly installed at your site, the
145 command
146
147 info coreutils 'sort invocation'
148
149 should give you access to the complete manual.
150
151
152
153GNU coreutils 8.4 June 2018 SORT(1)