count files in directory linux

Shell
ls | wc -lfind . -type d -print0 | while read -d '' -r dir; do
    files=("$dir"/*)
    printf "%5d files in directory %s\n" "${#files[@]}" "$dir"
done
Source

Also in Shell: