sort and uniq

say it: “sort and yoo-NEEK” /sɔːrt ænd juˈnik/

`sort` orders lines; `uniq` removes or counts repeats.

What does sort and uniq do?

sort puts lines in order; uniq removes repeated neighboring lines (so sort first). uniq -c counts them.

sort names.txt | uniq -c | sort -rn | head

Level: Journeyman · More Unix terms at this level

Updated