Anything faster than 'du' ?

David Bandel david.bandel
Tue Jul 3 11:48:18 PDT 2007


On 7/2/07, Bill Campbell <linux-sxs at celestial.com> wrote:
> On Mon, Jul 02, 2007, Michael Hipp wrote:
> >Is there a faster way to determine the size of a deep directory of files
> >rather than using 'du'?  It (du) is really painful if there are lots of
> >files or the medium is slow like USB?
>
> Anything that has to scan an entire directory structure, and stat()
> all the entries to get the sizes is going to take a fair amount
> of time.  I haven't looked at the code for ``du'', but I would
> have to guess that it's pretty lean.
>

Bill's right.  This is a _very_ mature program.  Most of the time it
takes to run through the directory structures, though, has more to do
with screen display speed than du doing its job.  If you don't believe
me, redirect output to a file (/dev/null is a good test) and watch how
fast you get a prompt.

Ciao,

David A. Bandel
-- 
Focus on the dream, not the competition.
            - Nemesis Air Racing Team motto



More information about the Linux-users mailing list