31

I have found the term "LSB executable" or "LSB shared object" in the output of the file command in Linux. For example:

$ file /bin/ls
/bin/ls: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=4637713da6cd9aa30d1528471c930f88a39045ff, stripped

What does "LSB" mean in this context?

Evan Carroll
  • 28,578
  • 45
  • 164
  • 290
yoyo_fun
  • 855
  • 3
  • 9
  • 14

1 Answers1

52

“LSB” here stands for “least-significant byte” (first), as opposed to “MSB”, “most-significant byte”. It means that the binary is little-endian.

file determines this from the sixth byte of the ELF header.

muru
  • 69,900
  • 13
  • 192
  • 292
Stephen Kitt
  • 411,918
  • 54
  • 1,065
  • 1,164
  • 1
    The other answer stated something completely different... Linux Standard Base.... Why is there confusion regarding this subject? I think you are probably right. It sounds like a more reasonable explanation. – yoyo_fun Sep 20 '17 at 11:28
  • 7
    There is confusion because “LSB” is an acronym covering different meanings. It can mean “Linux Standard Base” in other contexts; however in `file`’s output it means “least-significant byte” (as evidenced by the source code I linked to). – Stephen Kitt Sep 20 '17 at 11:29
  • Many acronyms mean many different things. However my question was not: "What does LSB mean?" , but a more specific one regarding strictly executable files in ELF format. – yoyo_fun Sep 20 '17 at 11:31
  • 4
    Yes, exactly; I don’t think your question is unclear. However many people will just stop at “LSB” and reply “Linux Standard Base”. – Stephen Kitt Sep 20 '17 at 11:32
  • 1
    I expect the confusion stems from a few things. 1. Writing "LSB" on it's own to indicate little endian is pretty unusual. 2. The Linux standards base standardised quite a bit about modern linux systems. 3. Most Linux users have probabblly never used a big-endian Linux system. – plugwash Sep 20 '17 at 17:38
  • I've spent years thinking that the output meant the other LSB. The 'file' maintainers really need to change their output to something more obvious, like LE/BE. – EML Nov 07 '19 at 10:37