Sort Unique IP Addresses from Server Logs

I was checking the access logs on a server today, and I needed do a quick sort of unique IP addresses. Of course this was one for Stack Overflow; however, I’m adding this nice one-liner here for additional safe keeping:

cat access.log | awk '{print $1}' | sort -n | uniq -c | sort -nr | head -20