| 1 |
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.50.1. |
| 2 |
.TH SORT "1" "February 2026" "GNU coreutils 9.10" "User Commands" |
| 3 |
.SH NAME |
| 4 |
sort \- sort lines of text files |
| 5 |
.SH SYNOPSIS |
| 6 |
.B sort |
| 7 |
[\fI\,OPTION\/\fR]... [\fI\,FILE\/\fR]... |
| 8 |
.br |
| 9 |
.B sort |
| 10 |
[\fI\,OPTION\/\fR]... \fI\,--files0-from=F\/\fR |
| 11 |
.SH DESCRIPTION |
| 12 |
.\" Add any additional description here |
| 13 |
.PP |
| 14 |
Write sorted concatenation of all FILE(s) to standard output. |
| 15 |
.PP |
| 16 |
With no FILE, or when FILE is \-, read standard input. |
| 17 |
.PP |
| 18 |
Mandatory arguments to long options are mandatory for short options too. |
| 19 |
Ordering options: |
| 20 |
.TP |
| 21 |
\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#sort-b'\fB\-b, \-\-ignore\-leading\-blanks\fP\X'tty: link' |
| 22 |
ignore leading blanks when finding sort keys in each line |
| 23 |
.TP |
| 24 |
\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#sort-d'\fB\-d, \-\-dictionary\-order\fP\X'tty: link' |
| 25 |
consider only blanks and alphanumeric characters |
| 26 |
.TP |
| 27 |
\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#sort-f'\fB\-f, \-\-ignore\-case\fP\X'tty: link' |
| 28 |
fold lower case to upper case characters |
| 29 |
.TP |
| 30 |
\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#sort-g'\fB\-g, \-\-general\-numeric\-sort\fP\X'tty: link' |
| 31 |
compare according to general numerical value |
| 32 |
.TP |
| 33 |
\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#sort-i'\fB\-i, \-\-ignore\-nonprinting\fP\X'tty: link' |
| 34 |
consider only printable characters |
| 35 |
.TP |
| 36 |
\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#sort-M'\fB\-M, \-\-month\-sort\fP\X'tty: link' |
| 37 |
compare (unknown) < 'JAN' < ... < 'DEC' |
| 38 |
.TP |
| 39 |
\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#sort-h'\fB\-h, \-\-human\-numeric\-sort\fP\X'tty: link' |
| 40 |
compare human readable numbers (e.g., 2K 1G) |
| 41 |
.TP |
| 42 |
\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#sort-n'\fB\-n, \-\-numeric\-sort\fP\X'tty: link' |
| 43 |
compare according to string numerical value; |
| 44 |
see full documentation for supported strings |
| 45 |
.TP |
| 46 |
\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#sort-R'\fB\-R, \-\-random\-sort\fP\X'tty: link' |
| 47 |
shuffle, but group identical keys. See also \fBshuf\fP(1) |
| 48 |
.TP |
| 49 |
\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#sort--random-source'\fB\-\-random\-source=FILE\fP\X'tty: link' |
| 50 |
get random bytes from FILE |
| 51 |
.TP |
| 52 |
\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#sort-r'\fB\-r, \-\-reverse\fP\X'tty: link' |
| 53 |
reverse the result of comparisons |
| 54 |
.TP |
| 55 |
\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#sort--sort'\fB\-\-sort=WORD\fP\X'tty: link' |
| 56 |
sort according to WORD: |
| 57 |
general\-numeric \fB\-g\fR, human\-numeric \fB\-h\fR, month \fB\-M\fR, |
| 58 |
numeric \fB\-n\fR, random \fB\-R\fR, version \fB\-V\fR |
| 59 |
.TP |
| 60 |
\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#sort-V'\fB\-V, \-\-version\-sort\fP\X'tty: link' |
| 61 |
natural sort of (version) numbers within text |
| 62 |
.PP |
| 63 |
Other options: |
| 64 |
.TP |
| 65 |
\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#sort--batch-size'\fB\-\-batch\-size=NMERGE\fP\X'tty: link' |
| 66 |
merge at most NMERGE inputs at once; for more use temp files |
| 67 |
.TP |
| 68 |
\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#sort-c'\fB\-c, \-\-check, \-\-check=\,diagnose\-first\fP\X'tty: link'\/\fR |
| 69 |
check for sorted input; do not sort |
| 70 |
.TP |
| 71 |
\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#sort-C'\fB\-C, \-\-check=\,quiet\/, \-\-check=\,silent\fP\X'tty: link'\/\fR |
| 72 |
like \fB\-c\fR, but do not report first bad line |
| 73 |
.TP |
| 74 |
\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#sort--compress-program'\fB\-\-compress\-program=PROG\fP\X'tty: link' |
| 75 |
compress temporaries with PROG; decompress them with PROG \fB\-d\fR |
| 76 |
.TP |
| 77 |
\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#sort--debug'\fB\-\-debug\fP\X'tty: link' |
| 78 |
annotate the part of the line used to sort, |
| 79 |
and warn about questionable usage to standard error |
| 80 |
.TP |
| 81 |
\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#sort--files0-from'\fB\-\-files0\-from=F\fP\X'tty: link' |
| 82 |
read input from the files specified by NUL\-terminated names in file F; |
| 83 |
If F is \-, read names from standard input |
| 84 |
.TP |
| 85 |
\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#sort-k'\fB\-k, \-\-key=\,KEYDEF\fP\X'tty: link'\/\fR |
| 86 |
sort via a key; KEYDEF gives location and type |
| 87 |
.TP |
| 88 |
\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#sort-m'\fB\-m, \-\-merge\fP\X'tty: link' |
| 89 |
merge already sorted files; do not sort |
| 90 |
.TP |
| 91 |
\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#sort-o'\fB\-o, \-\-output=\,FILE\fP\X'tty: link'\/\fR |
| 92 |
write result to FILE instead of standard output |
| 93 |
.TP |
| 94 |
\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#sort-s'\fB\-s, \-\-stable\fP\X'tty: link' |
| 95 |
stabilize sort by disabling last\-resort comparison |
| 96 |
.TP |
| 97 |
\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#sort-S'\fB\-S, \-\-buffer\-size=\,SIZE\fP\X'tty: link'\/\fR |
| 98 |
use SIZE for main memory buffer |
| 99 |
.TP |
| 100 |
\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#sort-t'\fB\-t, \-\-field\-separator=\,SEP\fP\X'tty: link'\/\fR |
| 101 |
use SEP instead of non\-blank to blank transition |
| 102 |
.TP |
| 103 |
\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#sort-T'\fB\-T, \-\-temporary\-directory=\,DIR\fP\X'tty: link'\/\fR |
| 104 |
use DIR for temporaries, not $TMPDIR or \fI\,/tmp\/\fP; |
| 105 |
multiple options specify multiple directories |
| 106 |
.TP |
| 107 |
\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#sort--parallel'\fB\-\-parallel=N\fP\X'tty: link' |
| 108 |
change the number of sorts run concurrently to N |
| 109 |
.TP |
| 110 |
\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#sort-u'\fB\-u, \-\-unique\fP\X'tty: link' |
| 111 |
output only the first of lines with equal keys; |
| 112 |
with \fB\-c\fR, check for strict ordering |
| 113 |
.TP |
| 114 |
\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#sort-z'\fB\-z, \-\-zero\-terminated\fP\X'tty: link' |
| 115 |
line delimiter is NUL, not newline |
| 116 |
.TP |
| 117 |
\X'tty: link https://www.gnu.org/software/coreutils/sort#sort--help'\fB\-\-help\fP\X'tty: link' |
| 118 |
display this help and exit |
| 119 |
.TP |
| 120 |
\X'tty: link https://www.gnu.org/software/coreutils/sort#sort--version'\fB\-\-version\fP\X'tty: link' |
| 121 |
output version information and exit |
| 122 |
.PP |
| 123 |
KEYDEF is F[.C][OPTS][,F[.C][OPTS]] for start and stop position, where F is a |
| 124 |
field number and C a character position in the field; both are origin 1, and |
| 125 |
the stop position defaults to the line's end. If neither \fB\-t\fR nor \fB\-b\fR is in |
| 126 |
effect, characters in a field are counted from the beginning of the preceding |
| 127 |
whitespace. OPTS is one or more single\-letter ordering options [bdfgiMhnRrV], |
| 128 |
which override global ordering options for that key. If no key is given, use |
| 129 |
the entire line as the key. Use \fB\-\-debug\fR to diagnose incorrect key usage. |
| 130 |
.PP |
| 131 |
SIZE may be followed by the following multiplicative suffixes: |
| 132 |
% 1% of memory, b 1, K 1024 (default), and so on for M, G, T, P, E, Z, Y, R, Q. |
| 133 |
.PP |
| 134 |
*** WARNING *** |
| 135 |
The locale specified by the environment affects sort order. |
| 136 |
Set LC_ALL=C to get the traditional sort order that uses |
| 137 |
native byte values. |
| 138 |
.SH AUTHOR |
| 139 |
Written by Mike Haertel and Paul Eggert. |
| 140 |
.SH "REPORTING BUGS" |
| 141 |
Report bugs to: bug\[email protected] |
| 142 |
.br |
| 143 |
GNU coreutils home page: <https://www.gnu.org/software/coreutils/> |
| 144 |
.br |
| 145 |
General help using GNU software: <https://www.gnu.org/gethelp/> |
| 146 |
.br |
| 147 |
Report any translation bugs to <https://translationproject.org/team/> |
| 148 |
.SH "SEE ALSO" |
| 149 |
\fBshuf\fP(1), \fBuniq\fP(1) |
| 150 |
.PP |
| 151 |
.br |
| 152 |
Full documentation <https://www.gnu.org/software/coreutils/sort> |
| 153 |
.br |
| 154 |
or available locally via: info \(aq(coreutils) sort invocation\(aq |
| 155 |
.PP |
| 156 |
.br |
| 157 |
Packaged by Debian (9.10\-1) |
| 158 |
.br |
| 159 |
Copyright \(co 2026 Free Software Foundation, Inc. |
| 160 |
.br |
| 161 |
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>. |
| 162 |
.br |
| 163 |
This is free software: you are free to change and redistribute it. |
| 164 |
.br |
| 165 |
There is NO WARRANTY, to the extent permitted by law. |