How to find size of code and data segments of a program
The Linux provides a command “size” which can shows the sizes of various segments of an executable program.
The following example shows how it can be used:
[neo@techpulp ~]# size /usr/lib/libopensync.so.1.0.0 text data bss dec hex filename 387800 3516 28 391344 5f8b0 /usr/lib/libopensync.so.1.0.0 [neo@techpulp ~]#
As you can see the “size” command displays size of “text”, “data” and “bss” segments. The above example used a shared library. However the same can be run against a program as well.
[neo@techpulp ~]# size /bin/bash text data bss dec hex filename 729668 19416 19444 768528 bba10 /bin/bash [neo@techpulp ~]#

