Re: appimage magic
On Tue 12 Nov 2024 at 02:47:21 (+0000), fxkl47BF@protonmail.com wrote:
> i down loaded super_program.appimage
> on the command line i type ./super_program.appimage
> how does my debian powered device know what to do
It looks at the file signature, or "magic number", in the first few
bytes of the file. For example, type:
$ hexdump -C /bin/cat | head -n 1
00000000 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 |.ELF............|
$
and the 7f 45 4c 46 sequence means Executable and Linkable Format.
OTOH, in:
$ hexdump -C /bin/firefox | head -n 1
00000000 23 21 2f 62 69 6e 2f 73 68 0a 0a 46 49 52 45 46 |#!/bin/sh..FIREF|
$
the first two bytes, 23 21, indicate that the file should be passed
to the program whose name immediately follows, ie /bin/sh, which is
normally the dash shell in Debian.
See https://en.wikipedia.org/wiki/List_of_file_signatures for
loads more magic numbers.
Cheers,
David.
Reply to: