简体   繁体   中英

how does linux execute a file

First I chmod +x to these following files forcibly, and when I tried to execute a PNG file in linux, I got the error like this:

: command not found.png: line 1: ‰PNG
./default_1920x1200.png: line 2: : command not found
IHDR€0Wö: command not foundne 3:
./default_1920x1200.png: line 4: OiCCPPhotoshop: command not found
./default_1920x1200.png: line 4: *!: command not found
./default_1920x1200.png: line 5: Øä!¢Žƒ£ˆŠÊûá{£kÖ¼÷æÍþµ×: command not found
./default_1920x1200.png: line 5364: warning: here-document at line 9 delimited by end-of-file (wanted `+À¾xÓ
                                                                                                           ÀM›À0‡ÿêB™\€„Àt‘8€@zŽB¦@F€&S `ËcbãP-`æÓ€WW.(ÎI+6aaš@.Ây™24àóÌ ‘àƒóýxήÎÎ6Ž¶_-ê¿ÿbbãþåÏ«p@át~Ñþ,/³€;€mþ¢%îh^

But when I try to execute a JPG or a BMP file, I can get a normal error like

-bash: ./s_x-r.bmp: cannot execute binary file

So I wonder how does the linux kernel execute a file?

It is exactly documented in execve(2) man page.

You can register additional ways thru the binfmt_misc directory inside /proc/sys/fs/

(Your desktop might have additional ways to "run" an application when you click on it)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM