[英]'size' vs 'ls -l' to get the size of an executable file
For the same file, I think the output of ls -l xxx
is always greater than or equal to the output of size xxx
. 对于同一文件,我认为
ls -l xxx
的输出始终大于或等于size xxx
的输出。
But when I type ls -l /bin/ls
the output is: 但是当我键入
ls -l /bin/ls
,输出为:
-rwxr-xr-x 1 root root 104508 1月 14 2015 /bin/ls
For size /bin/ls
, the output is: 对于
size /bin/ls
,输出为:
text data bss dec hex filename 101298 976 3104 105378 19ba2 /bin/ls
Why is ls
showing less than size
? 为什么
ls
显示的小于size
? 104508 < 105378 104508 <105378
ls -l
is telling you the size of the file, while the size
command tells you the size of the executable image stored in the file -- how much memory it will require when loaded. ls -l
告诉您文件的size
,而size
命令告诉您文件中存储的可执行映像的大小-加载时将需要多少内存。 Some segments (such as .bss) are zero-initialized rather than requiring data in the file to initialize them, so the the file may well be smaller than the executable image as a result. 有些段(例如.bss)是零初始化的,而不是要求文件中的数据对其进行初始化,因此,文件的大小可能会比可执行映像小。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.