count files in each directory linux code example
Example 1: How to count number of files in each directory
du -a | cut -d/ -f2 | sort | uniq -c | sort -nr
Example 2: shell show number of files in each folder
du -a | cut -d/ -f2 | sort | uniq -c | sort -nr