1SORT(1)                          User Commands                         SORT(1)
2
3
4

NAME

6       sort - sort lines of text files
7

SYNOPSIS

9       sort [OPTION]... [FILE]...
10       sort [OPTION]... --files0-from=F
11

DESCRIPTION

13       Write sorted concatenation of all FILE(s) to standard output.
14
15       With no FILE, or when FILE is -, read standard input.
16
17       Mandatory  arguments  to  long  options are mandatory for short options
18       too.  Ordering options:
19
20       -b, --ignore-leading-blanks
21              ignore leading blanks
22
23       -d, --dictionary-order
24              consider only blanks and alphanumeric characters
25
26       -f, --ignore-case
27              fold lower case to upper case characters
28
29       -g, --general-numeric-sort
30              compare according to general numerical value
31
32       -i, --ignore-nonprinting
33              consider only printable characters
34
35       -M, --month-sort
36              compare (unknown) < 'JAN' < ... < 'DEC'
37
38       -h, --human-numeric-sort
39              compare human readable numbers (e.g., 2K 1G)
40
41       -n, --numeric-sort
42              compare according to string numerical value
43
44       -R, --random-sort
45              shuffle, but group identical keys.  See shuf(1)
46
47       --random-source=FILE
48              get random bytes from FILE
49
50       -r, --reverse
51              reverse the result of comparisons
52
53       --sort=WORD
54              sort according to WORD: general-numeric  -g,  human-numeric  -h,
55              month -M, numeric -n, random -R, version -V
56
57       -V, --version-sort
58              natural sort of (version) numbers within text
59
60       Other options:
61
62       --batch-size=NMERGE
63              merge at most NMERGE inputs at once; for more use temp files
64
65       -c, --check, --check=diagnose-first
66              check for sorted input; do not sort
67
68       -C, --check=quiet, --check=silent
69              like -c, but do not report first bad line
70
71       --compress-program=PROG
72              compress temporaries with PROG; decompress them with PROG -d
73
74       --debug
75              annotate the part of the line used to sort, and warn about ques‐
76              tionable usage to stderr
77
78       --files0-from=F
79              read input from the files specified by NUL-terminated  names  in
80              file F; If F is - then read names from standard input
81
82       -k, --key=KEYDEF
83              sort via a key; KEYDEF gives location and type
84
85       -m, --merge
86              merge already sorted files; do not sort
87
88       -o, --output=FILE
89              write result to FILE instead of standard output
90
91       -s, --stable
92              stabilize sort by disabling last-resort comparison
93
94       -S, --buffer-size=SIZE
95              use SIZE for main memory buffer
96
97       -t, --field-separator=SEP
98              use SEP instead of non-blank to blank transition
99
100       -T, --temporary-directory=DIR
101              use  DIR  for temporaries, not $TMPDIR or /tmp; multiple options
102              specify multiple directories
103
104       --parallel=N
105              change the number of sorts run concurrently to N
106
107       -u, --unique
108              with -c, check for strict ordering; without -c, output only  the
109              first of an equal run
110
111       -z, --zero-terminated
112              line delimiter is NUL, not newline
113
114       --help display this help and exit
115
116       --version
117              output version information and exit
118
119       KEYDEF  is F[.C][OPTS][,F[.C][OPTS]] for start and stop position, where
120       F is a field number and C a character position in the field;  both  are
121       origin 1, and the stop position defaults to the line's end.  If neither
122       -t nor -b is in effect, characters in a field are counted from the  be‐
123       ginning of the preceding whitespace.  OPTS is one or more single-letter
124       ordering options [bdfgiMhnRrV], which override global ordering  options
125       for that key.  If no key is given, use the entire line as the key.  Use
126       --debug to diagnose incorrect key usage.
127
128       SIZE may be followed by the following multiplicative suffixes: % 1%  of
129       memory, b 1, K 1024 (default), and so on for M, G, T, P, E, Z, Y, R, Q.
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

AUTHOR

136       Written by Mike Haertel and Paul Eggert.
137

REPORTING BUGS

139       GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
140       Report any translation bugs to <https://translationproject.org/team/>
141
143       Copyright  ©  2023  Free Software Foundation, Inc.  License GPLv3+: GNU
144       GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
145       This is free software: you are free  to  change  and  redistribute  it.
146       There is NO WARRANTY, to the extent permitted by law.
147

SEE ALSO

149       shuf(1), uniq(1)
150
151       Full documentation <https://www.gnu.org/software/coreutils/sort>
152       or available locally via: info '(coreutils) sort invocation'
153
154
155
156GNU coreutils 9.3               September 2023                         SORT(1)
Impressum