[TriLUG] file and directory count

Tanner Lovelace lovelace at wayfarer.org
Thu Jul 31 16:30:35 EDT 2003


On Thu, 2003-07-31 at 16:23, JoJo Almario wrote:
> I have a newbie question.  Is there a command (like du -, or ls-  ) that 
> will give me a file and directory count?  like how many files and 
> directories under /home/users without having to count them one by one 
> after doing a "du" or an "ls" or "ll -a" command?


Well, if you want a count of directories you can do this:

find /home/users -type d | wc -l

Conversely for a count of files you can do this:

find /home/users -type f | wc -l

If you want a count of both directories *and* files together,
try:

find /home/users | wc -l

Cheers,
Tanner
-- 
Tanner Lovelace | lovelace(at)wayfarer.org | http://wtl.wayfarer.org/
--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--
GPG Fingerprint = A66C 8660 924F 5F8C 71DA  BDD0 CE09 4F8E DE76 39D4
GPG Key can be found at http://wtl.wayfarer.org/lovelace.gpg.asc
--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--
Don't move! Or I'll fill ya full of... little yellow bolts of light! 
                                Commander John Crichton (Farscape)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://www.trilug.org/pipermail/trilug/attachments/20030731/2fc8094d/attachment.pgp>


More information about the TriLUG mailing list