count number of files in a directory 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: how to check how many files are in a folder linux
$ ls | wc -l
du -a | cut -d/ -f2 | sort | uniq -c | sort -nr
$ ls | wc -l