Possible Duplicate:
ls command: what does the first line mean?

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 ) ?

marked as duplicate by Gilles, Renan, daisy, Mat, jasonwryan Nov 30 '12 at 7:38

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.


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 '12 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
  • 1
    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) – Stéphane Chazelas Nov 29 '12 at 13:54
  • 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 '12 at 14:27

total count of blocks, it includes also indirect blocks.

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