For the same file, I think the output of ls -l xxx
is always greater than or equal to the output of size xxx
.
But when I type ls -l /bin/ls
the output is:
-rwxr-xr-x 1 root root 104508 1月 14 2015 /bin/ls
For size /bin/ls
, the output is:
text data bss dec hex filename 101298 976 3104 105378 19ba2 /bin/ls
Why is ls
showing less than size
? 104508 < 105378
ls -l
is telling you the size of the file, while thesize
command tells you the size of the executable image stored in the file -- how much memory it will require when loaded. 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.