[cs631apue] sum of file size

Jan Schaumann jschauma at stevens.edu
Fri Oct 19 21:15:23 EDT 2012


jphillip <jphillip at stevens.edu> wrote:
> Hi Professor, I was wondering if you could clarify the behavior for ls  
> -l when printing the total size of the files.  The man page says "A  
> total sum for all the ?le sizes is output on a line before the long  
> listing." for both the -l (ell) and -s options.  Should this be in bytes  
> and is this line modified by the -h and -k flags?  Also, should this  
> total include the size of any files other than regular files?  Thanks!

Copmare to what the system's ls(1) does:

ls -s
BLOCKSIZE=512 ls -s
BLOCKSIZE=4096 ls -s

Repeat for 'ls -l'.

Also see the details of the 'Long Format' section in the manual page:

| In addition, 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.  

-Jan


More information about the cs631apue mailing list