Find the Best Cosmetic Hospitals

Explore trusted cosmetic hospitals and make a confident choice for your transformation.

“Invest in yourself — your confidence is always worth it.”

Explore Cosmetic Hospitals

Start your journey today — compare options in one place.

Linux pmap Command Guide: Inspect Process Memory Maps with Practical Examples

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.

pmap command examples in Linux

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 pathBest forStrengthLimitation
pmapPer-process mapping inspectionShows mappings and totals in readable outputFocused on one process at a time
psQuick process memory summaryFast snapshot (RSS/VSZ and more)No detailed mapping breakdown
top/htopLive monitoringContinuous view of many processesNot a deep memory map view
/proc/<pid>/maps and /proc/<pid>/smapsLow-level detailVery detailed kernel-provided dataManual 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.

OptionWhat it doesTypical use
pmap <pid>Shows default process mappingsQuick mapping overview
-xExtended format with allocation detailsInvestigating RSS/dirty-related detail per mapping
-dDevice formatInspecting mapping/device-oriented view
-qQuiet mode (suppresses some header/footer lines)Scripting or compact output
-VShows program versionChecking 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 ps for baseline context.
  • Run pmap -x for extended mapping details.
  • Use pmap -d when 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 columnGeneral meaningWhy it matters
Kbytes (or Size)Mapped size for regionShows virtual allocation footprint
RSSResident memory in RAMHelps explain physical memory pressure
DirtyModified pagesUseful when diagnosing write-heavy behavior
Mapping/ModePath or type plus permissionsIdentifies 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 pmap on 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 ps or top first for triage, then pmap for 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.

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services — all in one place.

Explore Hospitals
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.

Related Posts

How to Configure HTTP/HTTPS Proxy on Linux and Windows (CLI, GUI, Registry, and APT)

Set up proxy access correctly on Windows and Linux for command-line tools, package managers, and system-level use. This guide covers quick commands, persistent configuration, and common troubleshooting steps.

Read More

iostat Command Guide for Linux: 20 Practical Examples for CPU and Disk I/O Troubleshooting

Learn how to use iostat to monitor CPU and storage performance on Linux systems. This revised guide covers installation, 20 practical commands, metric interpretation, and a troubleshooting workflow.

Read More

xargs in Linux: Practical Commands, Safe Patterns, and Pipeline Workflows

This guide explains how to use xargs effectively in Linux/Unix shells, from basic stdin handling to safe file operations and parallel execution. You’ll learn practical command patterns, portability caveats, and safer alternatives.

Read More

Linux mount and umount Commands: Practical Examples, /etc/fstab, and Safe Unmounting

Learn how to mount and unmount filesystems reliably on Linux, from one-off commands to persistent /etc/fstab entries. This guide covers common filesystem types, command comparisons, and safe troubleshooting steps.

Read More

How to Use gsh to Run Linux Commands Across Multiple Servers

gsh (Group Shell) lets you execute one command across many Linux hosts from a single terminal. This guide explains host grouping with /etc/ghosts, core options, and practical command patterns.

Read More

Linux System Administrator Responsibilities: Daily Operations, Privileges, and Best Practices

Linux system administrators are responsible for server reliability, security, access control, patching, backups, and troubleshooting. This updated guide maps those responsibilities to practical workflows and command examples.

Read More
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
0
Would love your thoughts, please comment.x
()
x