uniq flags & options

-c, --count

Prefix lines by the number of occurrences.

sort file.txt | uniq -c
sort file.txt | uniq -c | sort -rn

-d, --repeated

Only print duplicate lines, one for each group.

sort file.txt | uniq -d

-u, --unique

Only print lines that are not repeated.

sort file.txt | uniq -u

-i, --ignore-case

Ignore differences in case when comparing.

sort file.txt | uniq -i

-f, --skip-fields

Avoid comparing the first N fields.

sort file.txt | uniq -f 1

-w, --check-chars

Compare no more than N characters in lines.

sort file.txt | uniq -w 10