The sort command
Sort lines of text. Prints the lines of the files (or of what is piped into it) in order. Upper and lower case sort together, like a dictionary.
A practice shell in your browser that behaves like bash on Linux for these commands. Nothing you type leaves the page.
Usage
sort [OPTION]... [FILE]...
Options
| -n, --numeric-sort | sort by the number at the start of each line, so 9 comes before 10 |
|---|---|
| -r, --reverse | reverse the order |
| -u, --unique | print each distinct line once |
| -f, --ignore-case | treat upper and lower case as the same when comparing |
| -k N | sort by the Nth word of each line instead of the whole line |
Examples
sort names.txtAlphabetical ordersort -n scores.txtSmallest number firstsort fruit.txt | uniq -c | sort -nrCount each line, most common first