Sort and deduplicate linux

Count and rank duplicate lines in a file

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