Current Article:

How to count number of files in each directory in Linux?

How to count number of files in each directory in Linux?

This prints the file count per directory for the current directory level:

du -a | cut -d/ -f2 | sort | uniq -c | sort -nr