# Basic syntax:
cat your_file | sort | uniq -c | sort -nr
# Where:
# - you can replace cat your_file with any command that produces output
# you want to sort in this way
# - sort sorts the input it gets from the upstream command and sorts it in
# alphanumeric order
# - uniq -c counts the number of occurrences of each line
# - sort -nr sorts the input it gets numerically in reverse order (high to
# low)
# Note, you have to sort before passing to uniq -c because uniq -c counts
# adjacent lines that are identical (and resets the count if they aren't)