How to list directory size?

epuster epuster at eecs.utk.edu
Sat Jun 28 18:13:14 UTC 2008


Robert Dailey wrote:
> On Sat, Jun 28, 2008 at 12:30 PM, Mike Bird <mgb-ubuntu at yosemite.net 
> <mailto:mgb-ubuntu at yosemite.net>> wrote:
>
>     On Sat June 28 2008 10:15:34 Robert Dailey wrote:
>     > On Sat, Jun 28, 2008 at 12:07 PM, Corey Bettenhausen
>     > <corey at 31415926535.com <mailto:corey at 31415926535.com>>
>     >
>     > wrote:
>     > > Robert Dailey wrote:
>     > > > On Sat, Jun 28, 2008 at 11:11 AM, Karl Larsen
>     <k5di at zianet.com <mailto:k5di at zianet.com>> wrote:
>     > > >> Robert Dailey wrote:
>     > > >>> Hi,
>     > > >>>
>     > > >>> I'm currently using Ubuntu Server 8. Is there a way to use
>     the 'ls'
>     > > >>
>     > > >> command
>     > > >>
>     > > >>> to display the size of a directory? That is, the size
>     should be the
>     > >
>     > > added
>     > >
>     > > >>> size of the contents of files and other subdirectories
>     (recursive).
>     > > >>
>     > > >>     I use $du -h which tells you how many gigabytes you have.
>     > > >
>     > > > That's almost what I'm looking for, except I don't want it to be
>     > >
>     > > recursive.
>     > > So, which is it?  Recursive or not?  Either way, "man du".
>      Take note of
>     > > the "--max-depth" option.  I usually like the "-c" option as well.
>     > > -Corey
>     >
>     > When I mentioned "recursive" in my original post, I was
>     referring to the
>     > math- The math that calculates the size of the folder should be
>     recursive,
>     > in that it will search the directory tree for all files under
>     the folder in
>     > question and add their sizes together to form the final
>     directory size. The
>     > display routine itself should *NOT* be recursive, as I only care
>     to see the
>     > size of a specific folder and NOT its contents.
>
>     When you carefully read "man du" before posting this question you
>     must have
>     accidently overlooked the "-s" switch.
>
>
> I posted this question because I didn't know about 'du'...
>
> -s switch did the trick.
If you're interested in seeing how space is distributed, rather than 
capturing text output, you can also use the Disk Usage Analyzer under 
Applications -> Accessories.

- Eric




More information about the ubuntu-users mailing list