sort

Sort lines alphabetically or numerically

sort arranges lines alphabetically by default. sort -n sorts numerically. sort -r reverses. sort -u removes duplicates while sorting.

Example

$ echo -e 'banana\napple\ncherry' | sort
apple
banana
cherry
Tip: Type it yourself in the terminal below - reading is not the same as doing.