Re: du

[prev] [thread] [next] [lurker] [Date index for 2005/09/30]

From: Luke Kanies
Subject: Re: du
Date: 19:39 on 30 Sep 2005
On Fri, 30 Sep 2005, Earle Martin wrote:

> On Fri, Sep 30, 2005 at 01:25:13AM +0200, Abigail wrote:
> >
> > Oh, just whatever order readdir is returning.
>
> If it's not alphabetic then it is damn near close to useless.

Well, it's not done that way for usefulness but for speed.  'find' does
not report files in sorted order, because you might not care if they are
sorted, so sorting them would unnecessarily slow things down.

This is obviously returning the files in the order they were added to
the directory.  'ls' always handily sorts your output (as does the shell
when you use metacharacters), but most tools don't by default.  If you
particularly want it sorted, then do so.  I have an alias that does just
that for me:

    du -dsk * | sudo sort -n

If I weren't willing to wait until all of the output were collected
(which is what happens in this case) I could pretty easily do it this
way:

    for dir in *; do # sorts the dirs
        du -dsk $dir
    done

-- 
   First they came for the hackers. But I never did anything
illegal with my computer, so I didn't speak up.
   Then they came for the pornographers. But I thought there was
too much smut on the Internet anyway, so I didn't speak up.
   Then they came for the anonymous remailers. But a lot of nasty
stuff gets sent from anon.penet.fi, so I didn't speak up.
   Then they came for the encryption users. But I could never
figure out how to work PGP anyway, so I didn't speak up.
   Then they came for me. And by that time there was no one left
to speak up.
                -- Alara Rogers, Aleph Press
---------------------------------------------------------------------
Luke Kanies | http://reductivelabs.com | http://config.sage.org

There's stuff above here

Generated at 16:00 on 04 Oct 2005 by mariachi 0.52