sort Command Examples

Sort lines of text files. More information: https://www.gnu.org/software/coreutils/sort.

sort {{path/to/file}}

sort --reverse {{path/to/file}}

sort --ignore-case {{path/to/file}}

sort --numeric-sort {{path/to/file}}

sort --field-separator={{:}} --key={{3n}} {{/etc/passwd}}

sort -t {{:}} -k {{3,3n}} -k {{4,4g}} {{/etc/passwd}}

sort --unique {{path/to/file}}

sort --output={{path/to/file}} {{path/to/file}}