pmap Command Examples in Linux

This tutorial explains Linux “pmap” command, options and its usage with examples.

pmap – report memory map of a process

Description :

The pmap command reports the memory map of a process or processes.

Usage :

pmap [ -x | -d ] [ -q ] pids…
pmap -V

Options :

advertisement
advertisement

-x
Show the extended format.
-d
Show the device format.
-q
Do not display some header/footer lines.
-V
Displays version of program.

Examples :

1. View the memory map of a process

$ pmap 3244       
3244:   man pmap
00314000    108K r-x--  /lib/ld-2.10.1.so
0032f000      4K r----  /lib/ld-2.10.1.so
00330000      4K rw---  /lib/ld-2.10.1.so
0035a000     20K r-x--  /usr/lib/libgdbm.so.3.0.0
0035f000      4K r----  /usr/lib/libgdbm.so.3.0.0
00360000      4K rw---  /usr/lib/libgdbm.so.3.0.0
00bf5000      4K r-x--    [ anon ]
00c83000   1272K r-x--  /lib/tls/i686/cmov/libc-2.10.1.so
00dc1000      4K -----  /lib/tls/i686/cmov/libc-2.10.1.so
00dc2000      8K r----  /lib/tls/i686/cmov/libc-2.10.1.so
00dc4000      4K rw---  /lib/tls/i686/cmov/libc-2.10.1.so
00dc5000     12K rw---    [ anon ]
00e62000     80K r-x--  /lib/libz.so.1.2.3.3
00e76000      4K r----  /lib/libz.so.1.2.3.3
00e77000      4K rw---  /lib/libz.so.1.2.3.3
08048000    164K r-x--  /usr/bin/man
08071000      4K r----  /usr/bin/man
08072000      4K rw---  /usr/bin/man
08073000      4K rw---    [ anon ]
09b3a000    380K rw---    [ anon ]
b78de000      8K rw---    [ anon ]
b78f3000      8K rw---    [ anon ]
bf8c0000     84K rw---    [ stack ]
 total     2192K

2. View memory map of multiple processes

Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!
$ pmap 13327 13353 13360

3. Extended Format Display using -x option

$ pmap 18282
18282:   man pmap
00007f3229279000   7044K r----  /usr/lib/locale/locale-archive
00007f322995a000     88K r-x--  /lib/x86_64-linux-gnu/libz.so.1.2.7
00007f3229970000   2044K -----  /lib/x86_64-linux-gnu/libz.so.1.2.7
00007f3229b6f000      4K r----  /lib/x86_64-linux-gnu/libz.so.1.2.7
00007f3229b70000      4K rw---  /lib/x86_64-linux-gnu/libz.so.1.2.7
00007f3229b71000     20K r-x--  /usr/lib/x86_64-linux-gnu/libgdbm.so.3.0.0
00007f3229b76000   2044K -----  /usr/lib/x86_64-linux-gnu/libgdbm.so.3.0.0
00007f3229d75000      4K r----  /usr/lib/x86_64-linux-gnu/libgdbm.so.3.0.0
00007f3229d76000      4K rw---  /usr/lib/x86_64-linux-gnu/libgdbm.so.3.0.0
00007f3229d77000   1784K r-x--  /lib/x86_64-linux-gnu/libc-2.17.so
00007f3229f35000   2044K -----  /lib/x86_64-linux-gnu/libc-2.17.so
00007f322a134000     16K r----  /lib/x86_64-linux-gnu/libc-2.17.so
00007f322a138000      8K rw---  /lib/x86_64-linux-gnu/libc-2.17.so
00007f322a13a000     20K rw---    [ anon ]
00007f322a13f000     48K r-x--  /usr/lib/x86_64-linux-gnu/libpipeline.so.1.2.2
00007f322a14b000   2044K -----  /usr/lib/x86_64-linux-gnu/libpipeline.so.1.2.2
00007f322a34a000      4K r----  /usr/lib/x86_64-linux-gnu/libpipeline.so.1.2.2
00007f322a34b000      4K rw---  /usr/lib/x86_64-linux-gnu/libpipeline.so.1.2.2
00007f322a34c000    116K r-x--  /usr/lib/man-db/libman-2.6.3.so
00007f322a369000   2044K -----  /usr/lib/man-db/libman-2.6.3.so
00007f322a568000      4K r----  /usr/lib/man-db/libman-2.6.3.so
00007f322a569000      4K rw---  /usr/lib/man-db/libman-2.6.3.so
00007f322a56a000      4K rw---    [ anon ]
00007f322a56b000     20K r-x--  /usr/lib/man-db/libmandb-2.6.3.so
00007f322a570000   2044K -----  /usr/lib/man-db/libmandb-2.6.3.so
00007f322a76f000      4K r----  /usr/lib/man-db/libmandb-2.6.3.so
00007f322a770000      4K rw---  /usr/lib/man-db/libmandb-2.6.3.so
00007f322a771000    140K r-x--  /lib/x86_64-linux-gnu/ld-2.17.so
00007f322a97a000     20K rw---    [ anon ]
00007f322a98a000     28K r--s-  /usr/lib/x86_64-linux-gnu/gconv/gconv-modules.cache
00007f322a991000      8K rw---    [ anon ]
00007f322a993000      4K r----  /lib/x86_64-linux-gnu/ld-2.17.so
00007f322a994000      8K rw---  /lib/x86_64-linux-gnu/ld-2.17.so
00007f322a996000     96K r-x--  /usr/bin/man
00007f322abae000      4K r----  /usr/bin/man
00007f322abaf000      4K rw---  /usr/bin/man
00007f322abb0000      4K rw---    [ anon ]
00007f322b356000    396K rw---    [ anon ]
00007fff237e1000    132K rw---    [ stack ]
00007fff23861000      8K r-x--    [ anon ]
ffffffffff600000      4K r-x--    [ anon ]
 total            22328K
 
$ pmap -x 18282
18282:   man pmap
Address           Kbytes     RSS   Dirty Mode   Mapping
00007f3229279000    7044      56       0 r----  locale-archive
00007f322995a000      88       8       0 r-x--  libz.so.1.2.7
00007f3229970000    2044       0       0 -----  libz.so.1.2.7
00007f3229b6f000       4       4       4 r----  libz.so.1.2.7
00007f3229b70000       4       4       4 rw---  libz.so.1.2.7
00007f3229b71000      20      16       0 r-x--  libgdbm.so.3.0.0
00007f3229b76000    2044       0       0 -----  libgdbm.so.3.0.0
00007f3229d75000       4       4       4 r----  libgdbm.so.3.0.0
00007f3229d76000       4       4       4 rw---  libgdbm.so.3.0.0
00007f3229d77000    1784     640       0 r-x--  libc-2.17.so
00007f3229f35000    2044       0       0 -----  libc-2.17.so
00007f322a134000      16      16      16 r----  libc-2.17.so
00007f322a138000       8       8       8 rw---  libc-2.17.so
00007f322a13a000      20      12      12 rw---    [ anon ]
00007f322a13f000      48      36       0 r-x--  libpipeline.so.1.2.2
00007f322a14b000    2044       0       0 -----  libpipeline.so.1.2.2
00007f322a34a000       4       4       4 r----  libpipeline.so.1.2.2
00007f322a34b000       4       4       4 rw---  libpipeline.so.1.2.2
00007f322a34c000     116      76       0 r-x--  libman-2.6.3.so
00007f322a369000    2044       0       0 -----  libman-2.6.3.so
00007f322a568000       4       4       4 r----  libman-2.6.3.so
00007f322a569000       4       4       4 rw---  libman-2.6.3.so
00007f322a56a000       4       4       4 rw---    [ anon ]
00007f322a56b000      20      16       0 r-x--  libmandb-2.6.3.so
00007f322a570000    2044       0       0 -----  libmandb-2.6.3.so
00007f322a76f000       4       4       4 r----  libmandb-2.6.3.so
00007f322a770000       4       4       4 rw---  libmandb-2.6.3.so
00007f322a771000     140     116       0 r-x--  ld-2.17.so
00007f322a97a000      20      20      20 rw---    [ anon ]
00007f322a98a000      28      24       0 r--s-  gconv-modules.cache
00007f322a991000       8       8       8 rw---    [ anon ]
00007f322a993000       4       4       4 r----  ld-2.17.so
00007f322a994000       8       8       8 rw---  ld-2.17.so
00007f322a996000      96      80       0 r-x--  man
00007f322abae000       4       4       4 r----  man
00007f322abaf000       4       4       4 rw---  man
00007f322abb0000       4       4       4 rw---    [ anon ]
00007f322b356000     396     320     320 rw---    [ anon ]
00007fff237e1000     132      20      20 rw---    [ stack ]
00007fff23861000       8       4       0 r-x--    [ anon ]
ffffffffff600000       4       0       0 r-x--    [ anon ]
----------------  ------  ------  ------
total kB           22356    1544     472

4. Display in Device Format

advertisement
$ pmap -d 18282
18282:   man pmap
Address           Kbytes Mode  Offset           Device    Mapping
00007f3229279000    7044 r---- 0000000000000000 008:00001 locale-archive
00007f322995a000      88 r-x-- 0000000000000000 008:00001 libz.so.1.2.7
00007f3229970000    2044 ----- 0000000000016000 008:00001 libz.so.1.2.7
00007f3229b6f000       4 r---- 0000000000015000 008:00001 libz.so.1.2.7
00007f3229b70000       4 rw--- 0000000000016000 008:00001 libz.so.1.2.7
00007f3229b71000      20 r-x-- 0000000000000000 008:00001 libgdbm.so.3.0.0
00007f3229b76000    2044 ----- 0000000000005000 008:00001 libgdbm.so.3.0.0
00007f3229d75000       4 r---- 0000000000004000 008:00001 libgdbm.so.3.0.0
00007f3229d76000       4 rw--- 0000000000005000 008:00001 libgdbm.so.3.0.0
00007f3229d77000    1784 r-x-- 0000000000000000 008:00001 libc-2.17.so
00007f3229f35000    2044 ----- 00000000001be000 008:00001 libc-2.17.so
00007f322a134000      16 r---- 00000000001bd000 008:00001 libc-2.17.so
00007f322a138000       8 rw--- 00000000001c1000 008:00001 libc-2.17.so
00007f322a13a000      20 rw--- 0000000000000000 000:00000   [ anon ]
00007f322a13f000      48 r-x-- 0000000000000000 008:00001 libpipeline.so.1.2.2
00007f322a14b000    2044 ----- 000000000000c000 008:00001 libpipeline.so.1.2.2
00007f322a34a000       4 r---- 000000000000b000 008:00001 libpipeline.so.1.2.2
00007f322a34b000       4 rw--- 000000000000c000 008:00001 libpipeline.so.1.2.2
00007f322a34c000     116 r-x-- 0000000000000000 008:00001 libman-2.6.3.so
00007f322a369000    2044 ----- 000000000001d000 008:00001 libman-2.6.3.so
00007f322a568000       4 r---- 000000000001c000 008:00001 libman-2.6.3.so
00007f322a569000       4 rw--- 000000000001d000 008:00001 libman-2.6.3.so
00007f322a56a000       4 rw--- 0000000000000000 000:00000   [ anon ]
00007f322a56b000      20 r-x-- 0000000000000000 008:00001 libmandb-2.6.3.so
00007f322a570000    2044 ----- 0000000000005000 008:00001 libmandb-2.6.3.so
00007f322a76f000       4 r---- 0000000000004000 008:00001 libmandb-2.6.3.so
00007f322a770000       4 rw--- 0000000000005000 008:00001 libmandb-2.6.3.so
00007f322a771000     140 r-x-- 0000000000000000 008:00001 ld-2.17.so
00007f322a97a000      20 rw--- 0000000000000000 000:00000   [ anon ]
00007f322a98a000      28 r--s- 0000000000000000 008:00001 gconv-modules.cache
00007f322a991000       8 rw--- 0000000000000000 000:00000   [ anon ]
00007f322a993000       4 r---- 0000000000022000 008:00001 ld-2.17.so
00007f322a994000       8 rw--- 0000000000023000 008:00001 ld-2.17.so
00007f322a996000      96 r-x-- 0000000000000000 008:00001 man
00007f322abae000       4 r---- 0000000000018000 008:00001 man
00007f322abaf000       4 rw--- 0000000000019000 008:00001 man
00007f322abb0000       4 rw--- 0000000000000000 000:00000   [ anon ]
00007f322b356000     396 rw--- 0000000000000000 000:00000   [ anon ]
00007fff237e1000     132 rw--- 0000000000000000 000:00000   [ stack ]
00007fff23861000       8 r-x-- 0000000000000000 000:00000   [ anon ]
ffffffffff600000       4 r-x-- 0000000000000000 000:00000   [ anon ]
mapped: 22328K    writeable/private: 624K    shared: 28K

5. Don’t show headers and footers in output

$ pmap -q 18282
18282:   man pmap
00007f3229279000   7044K r----  /usr/lib/locale/locale-archive
00007f322995a000     88K r-x--  /lib/x86_64-linux-gnu/libz.so.1.2.7
00007f3229970000   2044K -----  /lib/x86_64-linux-gnu/libz.so.1.2.7
00007f3229b6f000      4K r----  /lib/x86_64-linux-gnu/libz.so.1.2.7
00007f3229b70000      4K rw---  /lib/x86_64-linux-gnu/libz.so.1.2.7
00007f3229b71000     20K r-x--  /usr/lib/x86_64-linux-gnu/libgdbm.so.3.0.0
00007f3229b76000   2044K -----  /usr/lib/x86_64-linux-gnu/libgdbm.so.3.0.0
00007f3229d75000      4K r----  /usr/lib/x86_64-linux-gnu/libgdbm.so.3.0.0
00007f3229d76000      4K rw---  /usr/lib/x86_64-linux-gnu/libgdbm.so.3.0.0
00007f3229d77000   1784K r-x--  /lib/x86_64-linux-gnu/libc-2.17.so
00007f3229f35000   2044K -----  /lib/x86_64-linux-gnu/libc-2.17.so
00007f322a134000     16K r----  /lib/x86_64-linux-gnu/libc-2.17.so
00007f322a138000      8K rw---  /lib/x86_64-linux-gnu/libc-2.17.so
00007f322a13a000     20K rw---    [ anon ]
00007f322a13f000     48K r-x--  /usr/lib/x86_64-linux-gnu/libpipeline.so.1.2.2
00007f322a14b000   2044K -----  /usr/lib/x86_64-linux-gnu/libpipeline.so.1.2.2
00007f322a34a000      4K r----  /usr/lib/x86_64-linux-gnu/libpipeline.so.1.2.2
00007f322a34b000      4K rw---  /usr/lib/x86_64-linux-gnu/libpipeline.so.1.2.2
00007f322a34c000    116K r-x--  /usr/lib/man-db/libman-2.6.3.so
00007f322a369000   2044K -----  /usr/lib/man-db/libman-2.6.3.so
00007f322a568000      4K r----  /usr/lib/man-db/libman-2.6.3.so
00007f322a569000      4K rw---  /usr/lib/man-db/libman-2.6.3.so
00007f322a56a000      4K rw---    [ anon ]
00007f322a56b000     20K r-x--  /usr/lib/man-db/libmandb-2.6.3.so
00007f322a570000   2044K -----  /usr/lib/man-db/libmandb-2.6.3.so
00007f322a76f000      4K r----  /usr/lib/man-db/libmandb-2.6.3.so
00007f322a770000      4K rw---  /usr/lib/man-db/libmandb-2.6.3.so
00007f322a771000    140K r-x--  /lib/x86_64-linux-gnu/ld-2.17.so
00007f322a97a000     20K rw---    [ anon ]
00007f322a98a000     28K r--s-  /usr/lib/x86_64-linux-gnu/gconv/gconv-modules.cache
00007f322a991000      8K rw---    [ anon ]
00007f322a993000      4K r----  /lib/x86_64-linux-gnu/ld-2.17.so
00007f322a994000      8K rw---  /lib/x86_64-linux-gnu/ld-2.17.so
00007f322a996000     96K r-x--  /usr/bin/man
00007f322abae000      4K r----  /usr/bin/man
00007f322abaf000      4K rw---  /usr/bin/man
00007f322abb0000      4K rw---    [ anon ]
00007f322b356000    396K rw---    [ anon ]
00007fff237e1000    132K rw---    [ stack ]
00007fff23861000      8K r-x--    [ anon ]
ffffffffff600000      4K r-x--    [ anon ]

Sanfoundry Global Education & Learning Series – 1000 Linux Tutorials.

advertisement
If you wish to look at all Linux commands and their usage examples, go to Linux Commands Tutorial.

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.