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}'

Have a Unix Problem
Do you have a UNIX Question?

Unix Books :-
UNIX Programming, Certification, System Administration, Performance Tuning Reference Books

Return to : - Unix System Administration Hints and Tips

(c) www.gotothings.com All material on this site is Copyright.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
All product names are trademarks of their respective companies.
The site www.gotothings.com is in no way affiliated with or endorsed by any company listed at this site.
Any unauthorised copying or mirroring is prohibited.