On Thu, 2006-11-09 at 13:09 +1030, Tim wrote: > Jeff Vian: > >>> That is the size of the directory and its contents in kB. It is > >>> displayed with all 'ls' output using the -l flag. > > Tim: > >> Are you sure about that? I couldn't find any reference inside Fedora > >> about it. Something else, more general about Linux, said it was in > >> "blocks." Not true for Linux. AIX and others may use blocks but Linux uses bytes or kilobytes for almost all size displays. > > Jeff Vian: > > I am sure. See below. > > > > [root@raptor download]# ls -al movie > > total 1080028 > > drwxrwxr-x 2 jeff jeff 4096 Oct 31 2005 . > > drwxrwxr-x 110 jeff jeff 4096 Oct 27 18:23 .. > > -rw-r--r-- 1 jeff jeff 820366348 Aug 12 2005 myhomemovie.mpg > > -rw-r--r-- 1 jeff jeff 284465240 Sep 26 2002 myhomemovie2.mpg > > That kind of proves my point. You have 1.1 GB of files in that > directory, but the "total" is just a little over 1 million. It can't be > a total stated in the kilobytes. > Sure it is. Divide the sum of the file sizes by 1024 (1 KB) and you see that it is 1078945 which is just slightly less than the 1080028 which is displayed by du. The extra is overhead ... unused portions of blocks that are allocated but not actually occupied by data. File sizes from ls are the actual data size while du and df both take into account the total units (blocks) allocated. In that respect, the total line from ls is the allocated space, and may or may not be fully occupied by data depending on how close the file size is to occupying the last block fully. On most filesystems today in Linux the block size is 4096 so you can realistically have as much as 4095 unused bytes for each file causing the small discrepancies already noted. > > [root@raptor download]# du -s movie > > 1080020 movie > > "du" also works in blocks, unless you specify that it give you an output > in another way. Likewise, with "df". > In Linux the default display for du and df is units of 1 KB unless otherwise modified (other *nixs may display in blocks of 512 bytes or in KB). In Linux the default for ls is to display file size in bytes unless otherwise modified. The man pages for du and ls tell all. Test it yourself if you still need more information.