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)?
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
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.
Method 2
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
Method 3
total count of blocks, it includes also indirect blocks.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0