f



Size differs in 'size' and 'ls'

Hi all

I am new to this group and this is my first post.

Please see this output
[rayapudi@server7 myprog]$ size a.out
   text    data     bss     dec     hex filename
    876     260       4    1140     474 a.out
[rayapudi@server7 myprog]$ ls -l a.out
-rwxrwxr-x    1 sandeep  sandeep      4751 Sep 14 14:45 a.out

Total size by 'size' is 1140 bytes, but its '4751' with ls.
Can anyone tell me the reason for this?

Thanks in advance

Rayapudi

0
rayapudi
9/18/2006 5:30:32 AM
comp.unix.internals 340 articles. 0 followers. foxwphbrooksrucy is leader. Post Follow

2 Replies
446 Views

Similar Articles

[PageSpeed] 30

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


rayapudi wrote:
> Hi all
>
> I am new to this group and this is my first post.
>
> Please see this output
> [rayapudi@server7 myprog]$ size a.out
>    text    data     bss     dec     hex filename
>     876     260       4    1140     474 a.out
> [rayapudi@server7 myprog]$ ls -l a.out
> -rwxrwxr-x    1 sandeep  sandeep      4751 Sep 14 14:45 a.out
>
> Total size by 'size' is 1140 bytes, but its '4751' with ls.
> Can anyone tell me the reason for this?

Sure. size and ls are showing different values because they show
different things.

size dissects the structure of the a.out file to determine the
characteristics of the underlying binary program. It summarizes certain
components of the file. It does not report on the size of the file.

ls reports on the overall size of the file, without interpreting it's
structure or contents.

The size of an a.out file will be larger than the sum of it's component
parts, because the a.out includes information that, while used to
assemble the parts into a whole, is not counted as part of the contents
summary that size reports.

HTH
- --
Lew Pitcher

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (MingW32) - WinPT 0.11.12

iD8DBQFFDpTKagVFX4UWr64RAoFCAKCmKW6QQv3fopFbPDV0WN3aTJMbDgCfUm/a
febij5U+ePm8tTbpFSmad40=
=cfV+
-----END PGP SIGNATURE-----

0
Lew
9/18/2006 12:45:02 PM
In article <1158583502.825977.232570@e3g2000cwe.googlegroups.com>,
	"Lew Pitcher" <lpitcher@sympatico.ca> writes:
> rayapudi wrote:
>> Hi all
>>
>> I am new to this group and this is my first post.
>>
>> Please see this output
>> [rayapudi@server7 myprog]$ size a.out
>>    text    data     bss     dec     hex filename
>>     876     260       4    1140     474 a.out
>> [rayapudi@server7 myprog]$ ls -l a.out
>> -rwxrwxr-x    1 sandeep  sandeep      4751 Sep 14 14:45 a.out
>>
>> Total size by 'size' is 1140 bytes, but its '4751' with ls.
>> Can anyone tell me the reason for this?
> 
> Sure. size and ls are showing different values because they show
> different things.
> 
> size dissects the structure of the a.out file to determine the
> characteristics of the underlying binary program. It summarizes certain
> components of the file. It does not report on the size of the file.
> 
> ls reports on the overall size of the file, without interpreting it's
> structure or contents.
> 
> The size of an a.out file will be larger than the sum of it's component
> parts, because the a.out includes information that, while used to
> assemble the parts into a whole, is not counted as part of the contents
> summary that size reports.

Also, if the a.out is an ELF file, the sections will be aligned
on boundaries suitable for allowing them to be paged in directly
from the file. This will result in some wasted space between sections.

-- 
Andrew Gabriel
0
andrew
9/26/2006 10:03:54 PM
Reply: