Determining the number of files in a directory

Matthias Apitz m.apitz at
Sat Nov 3 07:01:56 PDT 2007

El día Saturday, November 03, 2007 a las 05:27:06AM -0700, White Hat escribió:

> This is probably a dumb question; however, I never let a little thing like that bother me in the past.
> Using FreeBSD-6.2 and Bash, how do I determine the number of files in a given directory? I have tried all sorts of combinations using different flags with the 'ls' command; however, none of them displays the number of files in the directory.
> Other than, by writing a script to accomplish this feat, how could I achieve my goal?

$ ls | wc -l

Matthias Apitz
Manager Technical Support - OCLC PICA GmbH
Gruenwalder Weg 28g - 82041 Oberhaching - Germany
t +49-89-61308 351 - f +49-89-61308 399 - m +49-170-4527211
e <m.apitz at> - w

More information about the freebsd-questions mailing list