What does size of a directory mean in output of ls -l command?
|
|
|
This is the size of space on the disk that is used to store the meta information for the directory (i.e. the table of files that belong to this directory). If it is i.e. 1024 this means that 1024 bytes on the disk are used (it always allocate full blocks) for this purpose. |
|||||||
|
|
A directory reserves 4096 bytes (at minimum) for meta-data about itself and its contents. Also, 4096 bytes is the default allocation unit (block) for ext2/ext3/ext4 filesystem and therefor a directory cannot be any smaller. On different filesystems you might find directories with different default sizes, that is due to the default block size of the filesystem. Directory sizes can also grow dynamically as they get filled, but once filled the space reserved for meta-data cannot be re-allocated without removal of the directory. |
|||||||||||
|
|
A directory is a just a directory, like a phone directory. It's just a file with a list of numbers and a name next to them. Each number references a file in the file-system (an inode number) and the name is the file name. You need disk space to save that data, how it is allocated and grown and shrunk is filesystem dependant. |
|||
|
|

