Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

This question already has an answer here:

On a server when I type in ls -al I get a list of the directories

-bash-3.2$ ls -al
total 12
drwxr-xr-x  3 root root    0 Feb 13  2011 .
drwxr-xr-x  4 root root 4096 May 11  2011 ..
drwxr-xr-x 55 torg torg 4096 May 15 05:40 stuff

However the total tells me that there should be 12 directories present. Why is this? I was under the impression that the -a flag revealed all directories. Is there some more effective way of seeing all directories, or is the total referring to something else?

share|improve this question
add comment

marked as duplicate by Gilles, Kevin, uther, Renan, jasonwryan Feb 18 '13 at 20:41

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.

1 Answer

up vote 1 down vote accepted

The total line is the number of blocks for all files referenced in that directory, not the number of directories. The number of directories is given by the link count of . (the number 3 before the user): It is one for the link to this directory from its parent plus one for the . pointing at itself plus one link for each subdirectory's .. entry. Your example's 3 is 1 subdirectory, the stuff. And in turn, stuff has 53 subdirectories.

share|improve this answer
add comment

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