I have an empty directory. I am using following command to view the contents of that directory.

ls -lart

The output I get is below.

total 12
drwxr-xr-x 5 root  root  4096 Oct  2 12:26 ..
drwxr-xr-x 2 apx   aim   4096 Nov 29 18:40 .

I don't have any files in this directory, then what counts out to 12 here (total 12)?


3 Answers 3


That is the total number of blocks taken up by the files, although I would expect the total to be 8 instead of 12 (using 1k blocks). Try ls -as1 to see the size in blocks of each file.

  • This is the output I get... total 12 4 drwxr-xr-x 5 root root 4096 Oct 2 12:26 .. 8 drwxr-xr-x 2 apx aim 4096 Nov 29 18:40 .
    – g4ur4v
    Nov 29, 2012 at 14:00

The "total" is the disk usage of listed files (because of -a including the . and .. entries) in blocks (1024 bytes or if POSIXLY_CORRECT is set in 512 bytes), not including the content of subdirectories.

If same files are not referenced and therefore listed twice (hard-links), you can get the same output with

du -Ss

or in human readable units

du -Ssh
  • 3
    No, ls just adds up the disk usage of the files listed (so . and .. are included only if -a is included), and contrary to du, ls doesn't account for hardlinks, so the result will be different. -a, -A (GNU), -L at least will affect the value reported. Also note that with GNU ls, the value will be different if POSIXLY_CORRECT is in the environment (block size 512) or not (block size 1024) Nov 29, 2012 at 13:54
  • 1
    Thanks Stephane Chazelas for your comment. I improved my answer. As GNU's du react also on POSIXLY_CORRECT, it should use the same block size.
    – jofel
    Nov 29, 2012 at 14:27

total count of blocks, it includes also indirect blocks.

Not the answer you're looking for? Browse other questions tagged .