🧀 Learn Linux

Commonly used · Reading and processing text

sort: Sort lines of text

Put in free practice

Syntax

sort [-nru] [file…]

Options

-n
Sort numerically
-r
Reverse order
-u
Remove duplicate rows

Examples

sort -n data/numbers.txt

Usage and sandbox support

The sandbox sorts alphabetically; the actual sorting is also affected by locale.

Hands-on exercises

Full documentation ↗

Related commands