On Tue, Nov 12, 2024 at 05:14:50AM +0000, fxkl4...@protonmail.com wrote:
> On Mon, 11 Nov 2024, David Wright wrote:
> 
> > On Tue 12 Nov 2024 at 02:47:21 (+0000), fxkl4...@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.
> >
> 
> i don't see anything in that about appimage

There are more of those patterns. Try "file":

  file super_proram.appimage

 pattern pattern patternsss

...what does it tell you?

Perhaps the binfmt_misc entry in the Wikipedia gives you a starting point
on how the Linux kernel decides what to do when it is told to "run" (aka
"exec") a file.

Cheers

[1] https://en.wikipedia.org/wiki/Binfmt_misc
-- 
t

Attachment: signature.asc
Description: PGP signature

Reply via email to