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

Re:Can somebody explain this? du & ls showing different sizes



>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


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