Re: Total in ls -la

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

 



Fajar Priyanto wrote:
> ls -la
> total 8
> drwxr-xr-x 2 fajar users 4096 2006-11-06 11:12 .
> drwxr-xr-x 3 fajar users 4096 2006-11-06 11:12 ..
> 
> What 'total 8' stands for?

Jeff Vian: 
> That is the size of the directory and its contents in kB.  It is
> displayed with all 'ls' output using the -l flag.

Tim wrote: 
> Are you sure about that?  I couldn't find any reference inside Fedora
> about it.  Something else, more general about Linux, said it was in
> "blocks."

OK, this goes back...

Early Unix used disk block-sizes of 512 bytes, and a number of Unix
utilities (including ls, du and df), when reporting disk usage, used
these 512 byte blocks. The POSIX standard (which defines how a Unix-like
system should behave) followed this, and made it mandatory for any
POSIX-compliant system.

Richard Stallman (who came up with the GNU project, the GPL, and was
behind the GNU versions of these utilities that Fedora uses) was actually
pretty involved with this standardization process (he also invented the
POSIX name, for example). He decided that using "blocks" of 1024 bytes
would be much easier for users. Unfortunately, he couldn't convince the
rest of the committee.

The GNU utilities were another matter -- Richard made sure that they
supported 1024-byte blocks, and they do to this day. But he also made
sure that the GNU utilities *could* support the 512-byte standard, and a
few other places where GNU practice diverges from the POSIX standard: if
you set the POSIXLY_CORRECT environment variable, you get POSIX
conformance.

There are quite a few references to this out there: search for
POSIXLY_CORRECT and either RMS or Stallman. But
http://www.gnu.org/software/fileutils/doc/manual/html/fileutils.html#Block%20size
is a good and authoritative reference.

Commercial Unix still uses 512-byte blocks by default, and this still
trips up various people when they try porting scripts.

Hope this helps,

James.

-- 
E-mail:     james@ | [Training spam filters] is somewhat like house-training a
aprilcottage.co.uk | puppy: it's a painful process, involving contact with
                   | unpleasant materials, and with a messy failure mode.
                   | And, somewhere in the process, something you care about
                   | is likely to get chewed up. -- Jonathan Corbet, lwn.net


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux