[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: du -h -d 1

From: Bob Proulx
Subject: Re: du -h -d 1
Date: Tue, 20 Aug 2002 10:46:09 -0600
User-agent: Mutt/1.4i

Max Stam <address@hidden> [2002-08-20 14:30:37 +0800]:
> Gidday Folks
> I couldn't find a general contact address for the fileutils authoring group
> so I sent this to here.

This is it!

> "A total size of everything in the current directory would be nice. We can
> control the number of directories deep we display with du's -d flag. -d
> takes one argument, the number of directories deep you want to show. A -0
> will just give you a simple subtotal of the files in a directory.

I have not understood what the advantage of -d0 is over just being
explicit.  Perhaps because it can't overrun ARG_MAX?  Don't know.

> #du -h -d0 $HOME
> 1.0G    /home/mwlucas
> #
> I have a GB in my home directory? Let's look a layer deeper and see where
> the heck it is.
> #du -h -d 1
>  52M    ./bin
> 1.4M    ./.kde
>  24K    ./pr
>  40K    ./.ssh
> 2.0K    ./.cvsup
> 812M    ./mp3
> 1.0K    ./.links
> 5.0K    ./.moonshine
> ...   "
> This is exactly what I want. Trouble is, it's for  BSD
> http://www.onlamp.com/pub/a/bsd/2001/09/27/Big_Scary_Daemons.html
> I'm not game to use BSD fileutils for Redhat 7.2 Linux. (don't know enough
> yet)

You just need to know that the option is --max-depth.  Which is fully
documented, by the way...  Try this instead.

  du -h --max-depth 1

Meanwhile you don't even need that option for what you want to do.
(Let's ignore hidden files for the moment.  They are hidden, after

  du -sh *
  du -sh */*
  du -sh */*/*

And so on.  Eventually you will run out of ARG_MAX space for
arguments.  At that point in time you can switch to the general
purpose 'find' utility to find and search files.  This also solves the
hidden file glob matching of the above.

  find . -maxdepth 2 -print0 | xargs -0 du -sh

Hope that helps.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]