This question already has an answer here:

As displayed by ls -al, for example:

drwxr-xr-x  9 jb jb 4.0K Mar  8 18:05 ./
drwx------ 49 jb jb 12K Mar 17 14:15 ../

I assume this is the minimum amount of space required to store the inode's metadata, e.g. that returned by stat, but I'm not entirely sure.

marked as duplicate by Gilles, vonbrand, Renan, jasonwryan, n0pe Mar 17 '13 at 23:27

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


. (dot for d, d for directory) is a hard link to its containing directory. You'll notice that:

ls -di . "$PWD"

return the same inode number. Its size is the number of bytes it needs (or possibly has ever needed) to store its content, that is the list of files it references (that are linked to it, which incidentally includes . and ..)

.. (the directory's directory) is a hardlink to the parent directory, that is the only directory where that directory is referenced from (directories can only have one link, if we don't consider the . and .. entries).


ls -di -- .. "$(dirname -- "$(pwd -P)")"

are going to return the same inode number as well.

So in your case .. is bigger than .. It probably contains more entries (or on those file systems where space allocated to directories is never reclaimed, .. once had that many entries that it required 12kB to store them, while . has never needed more than 4kB).

  • I knew their meaning but wasn't sure of the reason behind the sizes. In hindsight, I can see that similar questions have been asked before. – John Bensin Mar 17 '13 at 21:05

A directory on a typical Unix-like filesystem is just a specially attributed file. So is a symbolic link. Some Unix-like filesystems are able to store a tiny file such as a symbolic blink inside the inode. This means that no block has to be allocated to the file and since file size calculations do not count the inodes, the file has zero size.

A file whose data cannot fit into its inode has to occupy some kind of minimum unit of storage that is separately allocated from the inode. (And then the inode's data space is typically converted into an array of pointers to blocks of that storage.)

The simplest strategy is that everything is divided into indivisible blocks which are all the same size, and no two files can share storage within a single block. However, some filesystems like the Berkeley FFS can break up blocks into fragments assigned to different files in order to reduce waste.

The block size is decided at filesystem creation time, as a compromise between the addressing a huge disk and wasting space for small files. Typical block sizes are powers of two starting at around 512 (probably rare nowadays).

As you know every (non-root) directory contains at least two entries, because even an empty directory contains the . and .. links. If you see nonzero value as the size of even a completely empty directory, that indicates that in the given filesystem, those two basic directory entries are too large to fit into the tiny data area of the inode. So the directory data occupies a separately allocated block, or block fragment.

It looks like on your given filesystem, the block size is 4096 and there are no smaller fragments. (Or else, you have an even larger block size and 4096 is the size of a fragment.) A directory starts occupying a 4096 block/fragment, and when enough entries are added to that directory to run out of space in that unit, the directory grows to 8192, and then to 12 kilobytes and so on.

A large-ish value for .. indicates that the parent is a sizeable directory, which has no bearing on the size of the child directory.

Not the answer you're looking for? Browse other questions tagged or ask your own question.