number of files in directory ubuntu code example
Example: number of files in directory ubuntu
# To count files (even files without an extension) at the root of the current directory, use:
ls -l | grep ^- | wc -l
# To count files (even files without an extension) recursively from the root of the current directory, use:
ls -lR | grep ^- | wc -l