0 directory
Article directory
01. Overview of commands
The pmap command is used to report the memory mapping relationship of the process. It is a good tool for Linux debugging and operation.
02. Command format
pmap [option] process number [...]
03. Common Options
- x: Display extended format - d: Display device format - q: No head and tail lines are displayed - V: Display the specified version
04. Reference examples
Extended Format and Device Format Domain
Address: start address of map image start address Kbytes: size of map in kilobytes image size RSS: resident set size in kilobytes resident set size Dirty: dirty pages (both shared and private) in kilobytes dirty page size Mode: permissions on map image permissions: r=read, w=write, x=execute, s=shared, p=private (copy on write) Mapping: file backing the map, or'[anon]'for allocated memory, or'[stack]' for the program stack. Image support file, [anon] for allocated memory [stack] for program stack Offset: offset into the file file offset Device: device name (major: minor) device name
4.1 View the device format of process 1
[root@localhost ~]# pmap -d 1 1: /usr/lib/systemd/systemd --switched-root --system --deserialize 22 Address Kbytes Mode Offset Device Mapping 0000558b9e31a000 1408 r-x-- 0000000000000000 008:00003 systemd 0000558b9e679000 140 r---- 000000000015f000 008:00003 systemd 0000558b9e69c000 4 rw--- 0000000000182000 008:00003 systemd 0000558b9f184000 1292 rw--- 0000000000000000 000:00000 [ anon ] 00007effac000000 164 rw--- 0000000000000000 000:00000 [ anon ] 00007effac029000 65372 ----- 0000000000000000 000:00000 [ anon ] 00007effb4000000 164 rw--- 0000000000000000 000:00000 [ anon ] 00007effb4029000 65372 ----- 0000000000000000 000:00000 [ anon ]
4.2 View the device format of process 1 without showing the head and tail lines
[root@localhost ~]# pmap -d -q 1 1: /usr/lib/systemd/systemd --switched-root --system --deserialize 22 0000558b9e31a000 1408 r-x-- 0000000000000000 008:00003 systemd 0000558b9e679000 140 r---- 000000000015f000 008:00003 systemd 0000558b9e69c000 4 rw--- 0000000000182000 008:00003 systemd 0000558b9f184000 1292 rw--- 0000000000000000 000:00000 [ anon ] 00007effac000000 164 rw--- 0000000000000000 000:00000 [ anon ] 00007effac029000 65372 ----- 0000000000000000 000:00000 [ anon ] 00007effb4000000 164 rw--- 0000000000000000 000:00000 [ anon ]
4.3 View the Extended Format of Process 1
[root@localhost ~]# pmap -x 1 1: /usr/lib/systemd/systemd --switched-root --system --deserialize 22 Address Kbytes RSS Dirty Mode Mapping 0000558b9e31a000 1408 952 0 r-x-- systemd 0000558b9e679000 140 132 132 r---- systemd 0000558b9e69c000 4 4 4 rw--- systemd 0000558b9f184000 1292 1100 1100 rw--- [ anon ] 00007effac000000 164 12 12 rw--- [ anon ] 00007effac029000 65372 0 0 ----- [ anon ]
4.4 Loop shows the last line of device format for process 666, one second apart
[root@localhost ~]# while true; do pmap -d 666 |tail -1;sleep 1;done mapped: 115304K writeable/private: 416K shared: 28K mapped: 115304K writeable/private: 416K shared: 28K mapped: 115304K writeable/private: 416K shared: 28K mapped: 115304K writeable/private: 416K shared: 28K mapped: 115304K writeable/private: 416K shared: 28K mapped: 115304K writeable/private: 416K shared: 28K mapped: 115304K writeable/private: 416K shared: 28K mapped: 115304K writeable/private: 416K shared: 28K
5 appendix
Reference resources: [Linux] A step-by-step summary of the series of Linux tutorials