Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

sort

v(uutils coreutils) 0.1.0

Options

--help

sort-help-help

--version

sort-help-version

--sort
--human-numeric-sort, -h

sort-help-human-numeric

--month-sort, -M

sort-help-month

--numeric-sort, -n

sort-help-numeric

--general-numeric-sort, -g

sort-help-general-numeric

--version-sort, -V

sort-help-version-sort

--random-sort, -R

sort-help-random

--dictionary-order, -d

sort-help-dictionary-order

--merge, -m

sort-help-merge

--check, -c

sort-help-check

--check-silent, -C

sort-help-check-silent

--ignore-case, -f

sort-help-ignore-case

--ignore-nonprinting, -i

sort-help-ignore-nonprinting

--ignore-leading-blanks, -b

sort-help-ignore-leading-blanks

--output=<FILENAME>, -o <FILENAME>

sort-help-output

--reverse, -r

sort-help-reverse

--stable, -s

sort-help-stable

--unique, -u

sort-help-unique

--key, -k

sort-help-key

--field-separator, -t

sort-help-separator

--zero-terminated, -z

sort-help-zero-terminated

--parallel=<NUM_THREADS>

sort-help-parallel

--buffer-size=<SIZE>, -S <SIZE>

sort-help-buf-size

--temporary-directory=<DIR>, -T <DIR>

sort-help-tmp-dir

--compress-program=<PROG>

sort-help-compress-prog

--batch-size=<N_MERGE>

sort-help-batch-size

--files0-from=<NUL_FILE>

sort-help-files0-from

--debug

sort-help-debug

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 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/file}} {{path/to/file}}

The examples are provided by the tldr-pages project under the CC BY 4.0 License.

Please note that, as uutils is a work in progress, some examples might fail.