[TriLUG] Disk space calculations in Linux

William Sutton william at trilug.org
Thu Jan 24 18:53:16 EST 2008


While we're discussing... how much space gets wasted in overhead of files 
that allocate a particular block size but don't use all of the blocks?

William Sutton


On Thu, 24 Jan 2008, Kevin Hunter wrote:

> At 5:15p -0500 on 24 Jan 2008, James Tuttle wrote:
>> While we're at it, let's talk about du versus ls versus other size
>> calculating utilities.  I never know what to use.
>
> man pages will begin to point you the right direction.  As far as
> utilities go, ls and du serve two different roles: list files, and show
> disk usage.
>
> ls /can/ list files recursively and show their size, but it's oriented
> towards files more than disk usage.  Some common arguments of ls
>
> ls     # Straight up list your files in your directory.
> ls -l  # list in long format (incl. date, size, inode links, etc.)
> ls -lh # same as -l, but show size human-readable (e.g G, M, K)
> ls -lk # same as -l, but show in convert to kilobytes
>
> and if you want, ls -R lists recursively.
>
> du, on the other hand won't give you individual file information other
> than size and is meant for finding what files are the space hogs.  Try
>
> du
> du -h
> du -hs
> du -hs /dir1 /dir2 *
> du -ch
>
> Off the top of my head, df and *fdisk come to mind.  You may find this
> page a good starting point as well:
>
> http://en.wikipedia.org/wiki/Ls
>
> Kevin
> --
> TriLUG mailing list        : http://www.trilug.org/mailman/listinfo/trilug
> TriLUG Organizational FAQ  : http://trilug.org/faq/
> TriLUG Member Services FAQ : http://members.trilug.org/services_faq/
>
>



More information about the TriLUG mailing list