UNIX Programming, Certification, System Administration, Performance Tuning Reference Books
Counting Files or Directories

It's often useful to know the actual number of files or subdirectories in current directory, and I use it so often that I even made an aliases to the commands:

ls -la |grep "^-" |awk 'END {print "Number of files: " NR}'

and

ls -la |grep "^d" |awk 'END {print "Number of directories: " NR}'
 

Return to : Unix System Administration Hints and Tips