Searching for file types by count in specific folder in RHEL 6

So I'm trying to search for the top 10 or 15 items under a directory by file type. I want to run a command on a directory and get something like the following:

Example of expected output.. .PDF: 100, .txt: 95, .word: 80..

What would be the best way of going about this? I've searched around and couldn't really find a specific method on exactly doing this.

Thanks,
Jermey Moore

how about this for the starters:

find . -type f -name '*.*' | awk -F. '{a[$NF]++} END {for (i in a) print FS i ": " a}'
1 Like

Exclude files that start with a dot like .profile :

find . -type f -name '?*.*' | awk -F. '{a[$NF]++} END {for (i in a) print FS i ": " a}'

You can easily postprocess it with | sort -k2n

Moderator comments were removed during original forum migration.