Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What exactly does the size command (sans any flags) return in linux? if we are using a compiled assembler sourcecode, will this return the size useded by the program?

many thanks

share|improve this question

migrated from Dec 8 '09 at 12:45

This question came from our site for professional and enthusiast programmers.

what does "man size" say? – nb2580 Dec 8 '09 at 12:36
The question would be more convincing if you said you had already tried man size and didn't understand something in the information provided. As it is, the best answer is repeating the information from the man page. – Pascal Cuoq Dec 8 '09 at 12:37
lol, man size... almost as humorous as touch me – Ben Everard Dec 8 '09 at 12:37
sorry, i did try man size - and ive tried it witha number of complied programs "size - list section sizes and total size. " is from the manual, but i cant make much headway with determining what this is measuring. thanks – dr_the_aregentinian Dec 8 '09 at 12:38
The command "man elf" will give you more information on object internal format. If it looks involved and complicated, it is. – kmarsh Dec 8 '09 at 13:47

From the man page:

GNU size utility lists the section sizes---and the total size---for each of the object or archive files objfile in its argument list. By default, one line of output is generated for each object file or each module in an archive.

Here's an example output from running size foo.static

text data bss dec hex filename 6803811 221704 3419168 10444683 9f5f8b foo.static

This gives you the size of the text segment (also known as code segment), data segment, block started by symbol. dec is the size of the text, data and bss size added together. hex is the same number in hexadecimal.

share|improve this answer

You must log in to answer this question.