LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   /bin/ls "total" number reported??? (http://www.linuxquestions.org/questions/linux-newbie-8/bin-ls-total-number-reported-104628/)

JimDog 10-16-2003 06:26 AM

/bin/ls "total" number reported???
 
This has got to be an easy one, but I can't find the answer anywhere. What exactly is the "total" that is reported when you do an "ls"? I always thought it was the size in MB of the files listed, but it doesn't seem to add up.

Example, when I do a listing in one particular directory (ls -al) I get:

total 43456
drwxrwxrwx 2 root root 4096
drwxrwxrwx 3 root root 4096
-rwxrwxr-x 1 nobody nobody 3701594
-rwxrwxr-x 1 nobody nobody 3108510
-rwxrwxr-x 1 nobody nobody 3070580
-rwxrwxr-x 1 nobody nobody 3099733
-rwxrwxr-x 1 nobody nobody 2602570
-rwxrwxr-x 1 nobody nobody 3184369
-rwxrwxr-x 1 nobody nobody 2903501
-rwxrwxr-x 1 nobody nobody 2981555
-rwxrwxr-x 1 nobody nobody 2063089
-rwxrwxr-x 1 nobody nobody 2892216
-rwxrwxr-x 1 nobody nobody 3057414
-rwxrwxr-x 1 nobody nobody 4142959
-rwxrwxr-x 1 nobody nobody 3906603
-rwxrwxr-x 1 nobody nobody 3694698

Notice that everything adds up to 44,417,583;
but 43456 * 1024 = 44,498,944

iainr 10-16-2003 09:08 AM

I believe it is a total of the displayed blocks, including indirect blocks. Block size may vary but in your case you presumably have 1k blocks.

Balajisekar 03-14-2012 02:54 PM

Yes, It is the total block size... U can check them with "ls -s" option.

Thanks,
Balaji G

David the H. 03-15-2012 01:46 PM

The info pages for commands like this often go into a lot more detail than the man pages. Check out info ls for a detailed description of all its options.

Code:


`-l'
`--format=long'
`--format=verbose'
    In addition to the name of each file, print the file type, file
    mode bits, number of hard links, owner name, group name, size, and
    timestamp (*note Formatting file timestamps::), normally the
    modification time.  Print question marks for information that
    cannot be determined.

    Normally the size is printed as a byte count without punctuation,
    but this can be overridden (*note Block size::).  For example, `-h'
    prints an abbreviated, human-readable count, and
    `--block-size="'1"' prints a byte count with the thousands
    separator of the current locale.

    For each directory that is listed, preface the files with a line
    `total BLOCKS', where BLOCKS is the total disk allocation for all
    files in that directory.  The block size currently defaults to 1024
    bytes, but this can be overridden (*note Block size::).  The
    BLOCKS computed counts each hard link separately; this is arguably
    a deficiency.



All times are GMT -5. The time now is 09:03 AM.