SORT(1)
π SORT(1) π
okay bestie, welcome to sort(1) β a User Command, no big deal, just the lil tool that's been carrying your shell scripts since forever π
β¨ NAME β¨
sort β sort lines of text files πΈ
π SYNOPSIS π
sort [OPTION]... [FILE]...
sort [OPTION]... --files0-from=F
π¦ DESCRIPTION π¦
It writes the sorted concatenation of all FILE(s) to standard output. That's it. That's the whole vibe. π«Ά
If you give it no FILE at all, or if FILE is literally just -, it reads standard input. slay.
Mandatory arguments to long options are mandatory for short options too. (yes, fr fr, it means what it says π )
π₯ Ordering options π₯
-b,--ignore-leading-blanksβ ignore leading blanks when it's out here finding sort keys in each line β¨-d,--dictionary-orderβ only considers blanks and alphanumeric characters, nothing else invited to the party-f,--ignore-caseβ folds lower case into upper case characters, capitalization drama deleted π-g,--general-numeric-sortβ compares according to general numerical value-i,--ignore-nonprintingβ only printable characters count, the rest are invisible bestie π-M,--month-sortβ compares(unknown) < 'JAN' < ... < 'DEC'β calendar girl energy π-h,--human-numeric-sortβ compares human readable numbers, like2K,1Gβ the numbers your brain actually understands π-n,--numeric-sortβ compares according to string numerical value; see the full documentation for supported strings π-R,--random-sortβ shuffle, but group identical keys. See alsoshuf(1)π²--random-source=FILEβ get random bytes from FILE, so your chaos is reproducible-r,--reverseβ reverse the result of comparisons, flip the whole fit π--sort=WORDβ sort according to WORD: general-numeric-g, human-numeric-h, month-M, numeric-n, random-R, version-V-V,--version-sortβ natural sort of (version) numbers within text, sov2comes beforev10like a civilized person π
π Other options π
--batch-size=NMERGEβ merge at most NMERGE inputs at once; for more use temp files-c,--check,--check=diagnose-firstβ check for sorted input; do not sort. it's just looking, not touching π-C,--check=quiet,--check=silentβ like-c, but do not report first bad line π€«--compress-program=PROGβ compress temporaries with PROG; decompress them withPROG -d--debugβ annotate the part of the line used to sort, and warn about questionable usage to standard error π--files0-from=Fβ read input from the files specified by NUL-terminated names in file F; if F is-, read names from standard input-k,--key=KEYDEFβ sort via a key; KEYDEF gives location and type π-m,--mergeβ merge already sorted files; do not sort. they're already iconic, just line them up-o,--output=FILEβ write result to FILE instead of standard output-s,--stableβ stabilize sort by disabling last-resort comparison, so ties stay in their original order, periodt-S,--buffer-size=SIZEβ use SIZE for main memory buffer-t,--field-separator=SEPβ use SEP instead of non-blank to blank transition-T,--temporary-directory=DIRβ use DIR for temporaries, not$TMPDIRor/tmp; multiple options specify multiple directories--parallel=Nβ change the number of sorts run concurrently to N-u,--uniqueβ output only the first of lines with equal keys; with-c, check for strict ordering-z,--zero-terminatedβ line delimiter is NUL, not newline--helpβ display this help and exit--versionβ output version information and exit
π§ KEYDEF, explained (iykyk) π§
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 suffixes π
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. β οΈ bestie this one bites people every single day, do not skip it
π AUTHOR π
Written by Mike Haertel and Paul Eggert. legends, honestly.
π REPORTING BUGS π
Report bugs to: bug-coreutils@gnu.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 π
Full documentation <https://www.gnu.org/software/coreutils/sort> or available locally via: info '(coreutils) sort invocation'
Packaged by Ubuntu (9.10-1ubuntu2) π§ 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.
okay that's the whole page, you ate that π«Ά this version came from GNU coreutils 9.10, dated August 2026 β go forth and sort, main character π β¨
π¦ where this page comes from
- ubuntu stonking: gnu-coreutils 9.10-1ubuntu2 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms