What is the best command to get size of a executable file in Linux operating systems? Some says ls`` and other says
size``` command? Which one I need to use?
You need to use the ls -l command to get size of a executable file. For example, get size of the /bin/date executable, run:
ls -l /bin/date
ls -l ls -l /usr/sbin/userdel
-rwxr-xr-x 1 root root 100568 Jan 18 2018 /bin/date -rwxr-xr-x 1 root root 84464 Mar 23 00:35 /usr/sbin/userdel
So 100568 and 84464 is file size. On other hand, the size command list section sizes, total size and other data structure of exe file:
size /bin/date
See
https://www.cyberciti.biz/faq/linux-find-size-of-text-data-segment-bss-uninitialized-data/