Originally published on 2015-12-12; fully revised and updated.
The pmap command reports the memory map of a running process. It is useful for Linux administrators, SREs, and developers who need more detail than ps or top provide. In this guide, you will learn when to use pmap, how to use its most common options, and how to build a simple troubleshooting workflow for memory investigations.

Why use pmap instead of only ps or top
Tools like ps and top are excellent for quick memory summaries, but they do not show the full mapping layout of a process. pmap helps you inspect mapped regions and totals in one place, which is useful when diagnosing unexpected growth or understanding how memory is allocated.
| Tool or path | Best for | Strength | Limitation |
|---|---|---|---|
pmap | Per-process mapping inspection | Shows mappings and totals in readable output | Focused on one process at a time |
ps | Quick process memory summary | Fast snapshot (RSS/VSZ and more) | No detailed mapping breakdown |
top/htop | Live monitoring | Continuous view of many processes | Not a deep memory map view |
/proc/<pid>/maps and /proc/<pid>/smaps | Low-level detail | Very detailed kernel-provided data | Manual parsing can be time-consuming |
Basic pmap syntax and quick start
The core syntax is simple: run pmap with a process ID (PID).
# Basic usage
pmap 3724
# Find a PID first, then inspect it
pgrep -n sshd
pmap $(pgrep -n sshd)Code language: PHP (php)
For many builds of pmap, the output includes a final total line. That line is commonly used as a quick memory checkpoint.
pmap -x 3724 | tail -n 1
Common output modes and options
The original article highlighted the most frequently used options below.
| Option | What it does | Typical use |
|---|---|---|
pmap <pid> | Shows default process mappings | Quick mapping overview |
-x | Extended format with allocation details | Investigating RSS/dirty-related detail per mapping |
-d | Device format | Inspecting mapping/device-oriented view |
-q | Quiet mode (suppresses some header/footer lines) | Scripting or compact output |
-V | Shows program version | Checking behavior differences across environments |
pmap 3526
pmap -x 3526
pmap -d 3526
pmap -q 3526
pmap -V
Memory investigation workflow with pmap
When an application appears to consume too much memory, use a repeatable flow so you can compare snapshots and avoid guesswork.
flowchart TD
A[Alert high memory] --> B[Find target PID]
B --> C[Check quick metrics with ps]
C --> D[Run pmap -x for detailed map]
D --> E{Need device view}
E -- yes --> F[Run pmap -d]
E -- no --> G[Review totals and large mappings]
F --> G
G --> H[Repeat checks over time]
- Identify the target process PID.
- Capture a quick summary with
psfor baseline context. - Run
pmap -xfor extended mapping details. - Use
pmap -dwhen device-oriented mapping context is needed. - Repeat periodically to detect growth patterns.
# 1) Pick a target process (example: newest java process)
pid=$(pgrep -n java)
# 2) Quick baseline
ps -p "$pid" -o pid,ppid,%mem,rss,vsz,cmd
# 3) Detailed mapping snapshot
pmap -x "$pid"
# 4) Optional device-style view
pmap -d "$pid"
# 5) Track trend every 5 seconds
watch -n 5 "pmap -x $pid | tail -n 1"Code language: PHP (php)
How to read extended output safely
Extended output commonly includes columns such as size, resident pages, and dirty memory per mapping. Exact column names and availability may differ by Linux distribution and procps version, so always validate against your local man page.
| Common column | General meaning | Why it matters |
|---|---|---|
| Kbytes (or Size) | Mapped size for region | Shows virtual allocation footprint |
| RSS | Resident memory in RAM | Helps explain physical memory pressure |
| Dirty | Modified pages | Useful when diagnosing write-heavy behavior |
| Mapping/Mode | Path or type plus permissions | Identifies libraries, heaps, stacks, and files |
Reference
Man page used in the original post: http://linux.die.net/man/1/pmap
Best practices and common pitfalls
- Always confirm option behavior with
man pmapon the target host; output formats can vary by version. - Do not rely on a single snapshot for leak analysis; compare multiple samples over time.
- Use
psortopfirst for triage, thenpmapfor deep inspection. - If you see permission errors, run with appropriate privileges or as the process owner.
- When automating, prefer quiet/structured parsing patterns and validate on each distribution you support.
I’m Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked at Cotocus and regularly write about technology, travel, investing, health, product reviews, and digital marketing through my various platforms.
I publish technical articles at DevOps School, travel stories at Holiday Landmark, stock market insights at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow, and SEO and digital marketing strategies at Wizbrand.
Find Trusted Cardiac Hospitals
Compare heart hospitals by city and services — all in one place.
Explore Hospitals