sort -n file.txt

Category: Text Processing

sort -n file.txt

Sort lines numerically

Sorts lines treating them as numbers instead of text, so 10 comes after 9 (not before 2 as it would alphabetically).
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.