ls | wc -l
ls | wc -l #Count files on current directory
ls path/to/dir | wc -l #Count files on specific directory path
$ ls -l | wc -l
269
$ ls | wc -l
268
# Use this command
ls /etc | wc -l
# replace /etc with the path to the directory you want to work with
$ find /etc -type f | wc -l
2074
for i in */ .*/ ; do
echo -n $i": " ;
(find "$i" -type f | wc -l) ;
done
$ ls /etc | wc -l
268