简体   繁体   English

linux如何执行一个文件

[英]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:首先我强行chmod +x到以下这些文件,当我试图在linux中执行一个PNG文件时,我得到了这样的错误:

: 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但是当我尝试执行一个 JPG 或 BMP 文件时,我会得到一个正常的错误,比如

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

So I wonder how does the linux kernel execute a file?所以我想知道 linux kernel 是如何执行文件的?

It is exactly documented in execve(2) man page.它完全记录在execve(2)手册页中。

You can register additional ways thru the binfmt_misc directory inside /proc/sys/fs/您可以通过/proc/sys/fs/中的binfmt_misc目录注册其他方式

(Your desktop might have additional ways to "run" an application when you click on it) (您的桌面可能有其他方法可以在您单击应用程序时“运行”它)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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