sort [options] [file...]Arguments explained
- -n sorts numerically.
- -r reverses order.
- -u removes duplicate adjacent sorted lines.
- -k chooses a field key.
Common examples
sort names.txtPrints lines in sorted order.
sort access.log | uniq -c | sort -nr | headA common pipeline for top repeated lines.
| Field | Details |
|---|---|
| Command | sort |
| Category | Text Processing |
| Primary use | Sorts lines of text. |
| Syntax | sort [options] [file...] |