Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools Console Foundations Getting Started with the Console Running Commands

ls -l and ls-a give Total:0

Having or not hidden files/directories the total on the top of the list displays always 0 for whatever number of files I have in the current directory. I am using mac's terminal. What does it mean? Is this normal?

1 Answer

Steven Parker
Steven Parker
231,269 Points

I wouldn't expect to see a "total" line from the command "ls -a". But I would for "ls -l", and I would not expect to see 0 shown for a non-empty directory.

From "man 1 ls" on Mac OS X 10.6.7, specifically the section titled "The Long Format":

,,, for each directory whose contents are displayed, the total number of 512-byte blocks used by the files in the directory is displayed on a line by itself, immediately before the information for the files in the directory.

Thank you:) Strange, now I tried again and with ls -l gave me in fact the correct total number. Yes, you are right with ls -a there is no total to display.