pmap命令来自英文词组“process memory map”的缩写,其功能是用于显示进程的内存映像信息。pmap命令能够显示进程映像的起始地址、虚拟内存大小、进程访问地址空间的权限以及内存映像文件等信息,而我们只需告知进程号码即可。

语法格式:pmap [参数] 进程ID

常用参数:

-c 读取默认配置
-d 显示内存映射文件的偏移值、主次设备号等信息
-h 显示帮助信息
-n 创建新的配置
-N 创建新的配置并保存到文件
-p 显示文件的完整路径
-q 静默执行模式
-V 显示版本信息
-x 显示物理内存大小、未同步磁盘页面数量等信息

参考示例

显示进程的内存映像概况:

[root@linuxcool ~]# pmap 1098
1098:   /usr/sbin/sshd -D -oCiphers=aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes256-ctr,aes256-cbc,aes128-gcm@openssh.com,aes128-ctr,aes128-cbc -oMACs=hmac-sha2-256-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha2-256,hmac-sha1,umac-128@openssh.com,hmac-sha2-512 -oGSSAPIKexAlgorithms=gss-gex-sha1-,gss-group14-sha1- -oKexAlgorithms=curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-
000055e5b8d58000    808K r-x-- sshd
000055e5b9021000     16K r---- sshd
000055e5b9025000      4K rw--- sshd
………………省略部分输出信息………………

显示进程的地址空间等信息:

[root@linuxcool ~]# pmap -x 1098
1098:   /usr/sbin/sshd -D -oCiphers=aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes256-ctr,aes256-cbc,aes128-gcm@openssh.com,aes128-ctr,aes128-cbc -oMACs=hmac-sha2-256-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha2-256,hmac-sha1,umac-128@openssh.com,hmac-sha2-512 -oGSSAPIKexAlgorithms=gss-gex-sha1-,gss-group14-sha1- -oKexAlgorithms=curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-
Address           Kbytes     RSS   Dirty Mode  Mapping
000055e5b8d58000     808     656       0 r-x-- sshd
000055e5b9021000      16      16      16 r---- sshd
000055e5b9025000       4       4       4 rw--- sshd
………………省略部分输出信息………………
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。