SORT(1)

NAME
sort - Display sorted concatenation of all FILE(s). With no FILE, or when FILE is -, read standard input.

SYNOPSIS
sort [--help] [--version] [--sort] [-h|--human-numeric-sort] [-M|--month-sort] [-n|--numeric-sort] [-g|--general-numeric-sort] [-V|--version-sort] [-R|--random-sort] [--random-source] [-d|--dictionary-order] [-m|--merge] [-c|--check] [-C|--check-silent] [-f|--ignore-case] [-i|--ignore-nonprinting] [-b|--ignore-leading-blanks] [-o|--output] [-r|--reverse] [-s|--stable] [-u|--unique] [-k|--key] [-t|--field-separator] [-z|--zero-terminated] [--parallel] [-S|--buffer-size] [-T|--temporary-directory] [--compress-program] [--batch-size] [--files0-from] [--debug] [files]

DESCRIPTION
Display sorted concatenation of all FILE(s). With no FILE, or when FILE is -, read standard input.

OPTIONS

--help
    Print help information.

--version
    Print version information.

--sort
    Possible values:

    •   general-numeric

    •   human-numeric

    •   month

    •   numeric

    •   version

    •   random

-h, --human-numeric-sort
    compare according to human readable sizes, eg 1M > 100k

-M, --month-sort
    compare according to month name abbreviation

-n, --numeric-sort
    compare according to string numerical value

-g, --general-numeric-sort
    compare according to string general numerical value

-V, --version-sort
    Sort by SemVer version number, eg 1.12.2 > 1.1.2

-R, --random-sort
    shuffle in random order

--random-source <FILE>
    use FILE as a source of random data

-d, --dictionary-order
    consider only blanks and alphanumeric characters

-m, --merge
    merge already sorted files; do not sort

-c, --check
    check for sorted input; do not sort Possible values:

    •   silent

    •   quiet

    •   diagnose-first

-C, --check-silent
    exit successfully if the given file is already sorted, and exit with status 1 otherwise.

-f, --ignore-case
    fold lower case to upper case characters

-i, --ignore-nonprinting
    ignore nonprinting characters

-b, --ignore-leading-blanks
    ignore leading blanks when finding sort keys in each line

-o, --output <FILENAME>
    write output to FILENAME instead of stdout

-r, --reverse
    reverse the output

-s, --stable
    stabilize sort by disabling last-resort comparison

-u, --unique
    output only the first of an equal run

-k, --key
    sort by a key

-t, --field-separator
    custom separator for -k

-z, --zero-terminated
    line delimiter is NUL, not newline

--parallel <NUM_THREADS>
    change the number of threads running concurrently to NUM_THREADS

-S, --buffer-size <SIZE>
    sets the maximum SIZE of each segment in number of sorted items

-T, --temporary-directory <DIR>
    use DIR for temporaries, not $TMPDIR or /tmp

--compress-program <PROG>
    compress temporary files with PROG, decompress with PROG -d; PROG has to take input from stdin and output to stdout

--batch-size <N_MERGE>
    Merge at most N_MERGE inputs at once.

--files0-from <NUL_FILE>
    read input from the files specified by NUL-terminated NUL_FILE

--debug
    underline the parts of the line that are actually used for sorting

[files]

EXTRA
## Examples Sort a file in ascending order: sort {{path/to/file}} Sort a file in descending order: sort {{[-r|--reverse]}} {{path/to/file}} Sort a file in case-insensitive way: sort {{[-f|--ignore-case]}} {{path/to/file}} Sort a file using numeric rather than alphabetic order: sort {{[-n|--numeric-sort]}} {{path/to/file}} Sort `/etc/passwd` by the 3rd field onward of each line numerically, using `:` as a field separator: sort {{[-t|--field-separator]}} : {{[-k|--key]}} 3n /etc/passwd As above, but when items in the 3rd field are equal, sort by the 4th field by numbers with exponents: sort {{[-t|--field-separator]}} : {{[-k|--key]}} 3,3n {{[-k|--key]}} 4,4g /etc/passwd Sort a file preserving only unique lines: sort {{[-u|--unique]}} {{path/to/file}} Sort a file, printing the output to the specified output file (can be used to sort a file in-place): sort {{[-o|--output]}} {{path/to/output_file}} {{path/to/input_file}} > The examples are provided by the [tldr-pages project](https://tldr.sh) under the [CC BY 4.0 License](https://github.com/tldr-pages/tldr/blob/main/LICENSE.md). > > Please note that, as uutils is a work in progress, some examples might fail.

VERSION
v(uutils coreutils) 0.10.0