加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

linux – 将内存中正在运行的进程与磁盘中的可执行文件进行比较

发布时间:2020-12-13 16:58:46 所属栏目:Linux 来源:网络整理
导读:我有一个大项目,它将可执行文件(让我们称之为问候语)加载到内存中,但由于某种原因(例如,在不同目录下有许多文件称为问候语),我需要知道内存中的进程是否正好是我想用. 我知道如何比较两个文件:diff,cmp,cksum等.但有没有办法将内存中的进程与硬盘中的可执行
我有一个大项目,它将可执行文件(让我们称之为问候语)加载到内存中,但由于某种原因(例如,在不同目录下有许多文件称为问候语),我需要知道内存中的进程是否正好是我想用.

我知道如何比较两个文件:diff,cmp,cksum等.但有没有办法将内存中的进程与硬盘中的可执行文件进行比较?

解决方法

根据 this answer,您可以从proc文件系统获取二进制文件的内存版本的内容.我想你可以使用原始和内存版本.

According to the man page of /proc,under Linux 2.2 and later,the file is a symbolic link containing the actual pathname of the executed command. Apparently,the binary is loaded into memory,and /proc/[pid]/exe points to the content of the binary in memory.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读