Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 14 Oct 1996 00:13:33 -0700 (PDT)
From:      "Bryan K. Ogawa" <bkogawa@primenet.com>
To:        sergios@hol.gr
Cc:        questions@freebsd.org
Subject:   Re: find etc/
Message-ID:  <199610140713.AAA17123@foo.primenet.com>
References:  <2.2.32.19961013210810.009b891c@prometheus.hol.gr>

next in thread | previous in thread | raw e-mail | index | archive | help

In localhost.freebsd.questions you write:

>while we are at "find" can somebody explain me why a find . -name
>"something" takes so long and if there is a way I can speed things up.....3
>minutes to find all "somestring" from / and this on a eide system with 64Mb
>memory......a filesystem total of 1.2G ....

Finds take a long time because you're searching through possibly
several thousand files and directories looking for strings.  I'm
guessing the thing that probably affects your speed the most is the
average seek time on the disk--all of that searching through
directories takes seek time, not transfer time (nor memory or CPU).

To speed it up, you can use locate.  Locate uses a static database,
and is therefore much faster than actually going through the file
system.  However, it only locates world-readable files.  Use "locate
something" to use.  However, it returns things almost instantaneously.

Alternately, move as high in the directory tree as you can before
starting the search.  Searching /usr/home or /usr/local is much more
efficient than searching /usr , especially if you have the source code
in /usr/src installed.

>------------------------------------------------------------------------

-- 
bryan k ogawa  <bkogawa@primenet.com>   http://www.primenet.com/~bkogawa/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199610140713.AAA17123>