Can somebody explain this? du & ls showing different sizes

Felipe Nunez gatopardo at codetel.net.do
Sun Feb 15 22:47:30 UTC 2009


>Running du -h tells that the file occupies 512M but ls -l tells that
> the file is a lot smaller. Also I am sure the the cluster size is not
>512M (or am I wrong there?).

 In order to explain this behavior I did following test:
 $  echo "hello" > hi.txt
 $ ls -l      hi.txt
-rw-r--r-- 1 user group 6 2009-02-15 18:37 download/hi.txt
  (the size of the file is 6 bytes "hello" + '\n' )
 $ du hi.txt
 4.0K	hi.txt
 (the size of the block -cluster is a MicroSoft equivalent term- is 4.0K)
 That explains almost all. (Some data may be in memory in disk cache and can 
be some asynchrony with the file system)

 FN


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20090215/c0fabb7b/attachment-0001.htm>


More information about the fedora-list mailing list