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

前端 未结 4 1513
不思量自难忘°
不思量自难忘° 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:35

    4096, in your example, is the number of bytes used by the directory itself. In other words, this is the space required to store the list of items contained in the directory. It is not, as the question title suggests, the sum of the space of all of the items stored in the directory.

    You don't say what system you're using, but in many UNIX/Linux file systems, the minimum unit of storage allocation is 4K, which is why the size is showing as 4096. The directory entries for two items, plus "." and "..", should take considerably less space.

提交回复
热议问题