When running ls -l, why does the filesize on a directory not match the output of du?

前端 未结 4 1539
不思量自难忘°
不思量自难忘° 2021-01-21 02:43

What does 4096 mean in output of ls -l?

[root@file nutch-0.9]# du -csh resume.new/
2.3G    resume.new/
[root@file nutch-0.9]# ls -l 
total 55132
drw         


        
4条回答
  •  独厮守ぢ
    2021-01-21 03:26

    I have been wondering about it too. So, after searching I came across:

    "It's the size necessary to store the meta-data about files (including the file names contained in that directory). The number of files / sub-directories at a given time might not map directly to the size reported, because once allocated, space is not freed if the number of files changes. This behaviour makes sense for most use cases (where disk space is cheap, and once a directory has a lot of files in it, it will probably have them again in future), and helps to reduce fragmentation."

    Reference: http://www.linuxquestions.org/questions/showthread.php?p=2978839#post2978839

提交回复
热议问题