from small one page howto to huge articles all in one place

search text in:




Other .linuxhowtos.org sites:gentoo.linuxhowtos.org



Last additions:
using iotop to find disk usage hogs

using iotop to find disk usage hogs

words:

887

views:

210154

userrating:


May 25th. 2007:
Words

486

Views

259139

why adblockers are bad


Workaround and fixes for the current Core Dump Handling vulnerability affected kernels

Workaround and fixes for the current Core Dump Handling vulnerability affected kernels

words:

161

views:

150486

userrating:


April, 26th. 2006:

Druckversion
You are here: manpages





SORT

Section: User Commands (1)
Updated: February 2026
Index Return to Main Contents
 

NAME

sort - sort lines of text files  

SYNOPSIS

sort [,OPTION/]... [,FILE/]...
sort [,OPTION/]... ,-files-from=F/  

DESCRIPTION

Write sorted concatenation of all FILE(s) to standard output.

With no FILE, or when FILE is -, read standard input.

Mandatory arguments to long options are mandatory for short options too. Ordering options:

X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#sor-b'-b, --ignore-leading-blanksX'tty: link'
ignore leading blanks when finding sort keys in each line
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#sor-d'-d, --dictionary-orderX'tty: link'
consider only blanks and alphanumeric characters
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#sor-f'-f, --ignore-caseX'tty: link'
fold lower case to upper case characters
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#sor-g'-g, --general-numeric-sortX'tty: link'
compare according to general numerical value
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#sor-i'-i, --ignore-nonprintingX'tty: link'
consider only printable characters
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#sor-M'-M, --month-sortX'tty: link'
compare (unknown) < 'JAN' < ... < 'DEC'
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#sor-h'-h, --human-numeric-sortX'tty: link'
compare human readable numbers (e.g., 2K 1G)
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#sor-n'-n, --numeric-sortX'tty: link'
compare according to string numerical value; see full documentation for supported strings
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#sor-R'-R, --random-sortX'tty: link'
shuffle, but group identical keys. See also shuf(1)
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#sor-rando-source'--random-source=FILEX'tty: link'
get random bytes from FILE
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#sor-r'-r, --reverseX'tty: link'
reverse the result of comparisons
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#sor-sort'--sort=WORDX'tty: link'
sort according to WORD: general-numeric -g, human-numeric -h, month -M, numeric -n, random -R, version -V
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#sor-V'-V, --version-sortX'tty: link'
natural sort of (version) numbers within text

Other options:

X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#sor-batc-size'--batch-size=NMERGEX'tty: link'
merge at most NMERGE inputs at once; for more use temp files
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#sor-c'-c, --check, --check=,diagnose-firstX'tty: link'/
check for sorted input; do not sort
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#sor-C'-C, --check=,quiet/, --check=,silentX'tty: link'/
like -c, but do not report first bad line
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#sor-compres-program'--compress-program=PROGX'tty: link'
compress temporaries with PROG; decompress them with PROG -d
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#sor-debug'--debugX'tty: link'
annotate the part of the line used to sort, and warn about questionable usage to standard error
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#sor-files-from'--files0-from=FX'tty: link'
read input from the files specified by NUL-terminated names in file F; If F is -, read names from standard input
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#sor-k'-k, --key=,KEYDEFX'tty: link'/
sort via a key; KEYDEF gives location and type
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#sor-m'-m, --mergeX'tty: link'
merge already sorted files; do not sort
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#sor-o'-o, --output=,FILEX'tty: link'/
write result to FILE instead of standard output
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#sor-s'-s, --stableX'tty: link'
stabilize sort by disabling last-resort comparison
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#sor-S'-S, --buffer-size=,SIZEX'tty: link'/
use SIZE for main memory buffer
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#sor-t'-t, --field-separator=,SEPX'tty: link'/
use SEP instead of non-blank to blank transition
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#sor-T'-T, --temporary-directory=,DIRX'tty: link'/
use DIR for temporaries, not $TMPDIR or ,/tmp/; multiple options specify multiple directories
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#sor-parallel'--parallel=NX'tty: link'
change the number of sorts run concurrently to N
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#sor-u'-u, --uniqueX'tty: link'
output only the first of lines with equal keys; with -c, check for strict ordering
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#sor-z'-z, --zero-terminatedX'tty: link'
line delimiter is NUL, not newline
X'tty: link https://www.gnu.org/software/coreutils/sort#sor-help'--helpX'tty: link'
display this help and exit
X'tty: link https://www.gnu.org/software/coreutils/sort#sor-version'--versionX'tty: link'
output version information and exit

KEYDEF is F[.C][OPTS][,F[.C][OPTS]] for start and stop position, where F is a field number and C a character position in the field; both are origin 1, and the stop position defaults to the line's end. If neither -t nor -b is in effect, characters in a field are counted from the beginning of the preceding whitespace. OPTS is one or more single-letter ordering options [bdfgiMhnRrV], which override global ordering options for that key. If no key is given, use the entire line as the key. Use --debug to diagnose incorrect key usage.

SIZE may be followed by the following multiplicative suffixes: % 1% of memory, b 1, K 1024 (default), and so on for M, G, T, P, E, Z, Y, R, Q.

*** WARNING *** The locale specified by the environment affects sort order. Set LC_ALL=C to get the traditional sort order that uses native byte values.  

AUTHOR

Written by Mike Haertel and Paul Eggert.  

REPORTING BUGS

Report bugs to: bug-coreutils@gnu.org


Report Gentoo bugs to: https://bugs.gentoo.org/
GNU coreutils home page: <https://www.gnu.org/software/coreutils/>
General help using GNU software: <https://www.gnu.org/gethelp/>
Report any translation bugs to <https://translationproject.org/team/>  

SEE ALSO

shuf(1), uniq(1)


Full documentation <https://www.gnu.org/software/coreutils/sort>
or available locally via: info aq(coreutils) sort invocationaq


Packaged by Gentoo (9.10 (p0))
Copyright © 2026 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.


 

Index

NAME
SYNOPSIS
DESCRIPTION
AUTHOR
REPORTING BUGS
SEE ALSO





Support us on Content Nation
rdf newsfeed | rss newsfeed | Atom newsfeed
- Powered by LeopardCMS - Running on Gentoo -
Copyright 2004-2025 Sascha Nitsch Unternehmensberatung GmbH
Valid XHTML1.1 : Valid CSS
- Level Triple-A Conformance to Web Content Accessibility Guidelines 1.0 -
- Copyright and legal notices -
Time to create this page: 14.5 ms