All commands
sort
Topic: Text
Program: sort
Sorts lines.
Package: text-sort
Usage
sort [OPTION]... [FILE]...
Description
Put the lines of all FILEs together in order and print them. A FILE named -, or no FILE, means the keyboard or pipe. Without -t, a field starts with the spaces before it.
Options in the simulator
-
-b, --ignore-leading-blanks ignore spaces and tabs at the start of a key -
-c, --check only check whether the input is sorted; report the first line out of order -
-f, --ignore-case treat a to z like A to Z -
-h, --human-numeric-sort compare sizes like 2K or 1G -
-k, --key=KEYDEF sort by a part of the line: from field F (at character C) to an end field, such as 2,2 or 3n -
-M, --month-sort compare month names (JAN < ... < DEC) -
-n, --numeric-sort compare the number at the start of the key -
-o, --output=FILE write the result to FILE; FILE may also be an input -
-r, --reverse turn the order around -
-s, --stable keep equal lines in input order (no last comparison of whole lines) -
-t, --field-separator=SEP fields are separated by SEP instead of by spaces -
-u, --unique print equal lines only once -
-V, --version-sort compare version numbers like 1.2 < 1.10 -
--help show this help and exit
17 more options of the real program, not in the simulator yet
-
-d, --dictionary-order not in the simulator yet On a real system sort then compares only letters, digits and spaces.
-
-g, --general-numeric-sort not in the simulator yet On a real system sort also compares numbers written like 1e3.
-
-i, --ignore-nonprinting not in the simulator yet On a real system sort then skips control characters.
-
-R, --random-sort not in the simulator yet On a real system sort shuffles the lines, equal lines stay together.
-
--random-source needs a value not in the simulator yet On a real system sort shuffles the lines, equal lines stay together.
-
--sort needs a value not in the simulator yet On a real system it picks the kind of comparison by name, such as --sort=numeric.
-
--batch-size needs a value not in the simulator yet On a real system it only changes how sort works inside (memory, temporary files); the output stays the same.
-
-C not in the simulator yet On a real system sort checks like -c whether the input is sorted, but prints nothing; only the exit status tells.
-
--compress-program needs a value not in the simulator yet On a real system it only changes how sort works inside (memory, temporary files); the output stays the same.
-
--debug not in the simulator yet On a real system sort then marks which part of each line it compares.
-
--files0-from needs a value not in the simulator yet On a real system sort reads the names of its inputs from a file.
-
-m, --merge not in the simulator yet On a real system sort only merges files that are already sorted.
-
-S, --buffer-size needs a value not in the simulator yet On a real system it only changes how sort works inside (memory, temporary files); the output stays the same.
-
-T, --temporary-directory needs a value not in the simulator yet On a real system it only changes how sort works inside (memory, temporary files); the output stays the same.
-
--parallel needs a value not in the simulator yet On a real system it only changes how sort works inside (memory, temporary files); the output stays the same.
-
-z, --zero-terminated not in the simulator yet On a real system a zero byte instead of a newline ends each line, for names from find -print0.
-
--version not in the simulator yet On a real system it prints the version of the program.
Where you learn it
Lessons
Command of the day
All commands