Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

pmap

Report memory map of a process.

Description

Displays the memory map of one or more processes, showing the address ranges, sizes, permissions, and mapped files or regions for each mapping.

Inputs

  • /proc/[pid]/maps – memory mappings (address range, permissions, offset, device, inode, pathname)
  • /proc/[pid]/smaps – extended per-mapping memory info including RSS, Private_Dirty, and Shared_Dirty (used with -x)
  • /proc/[pid]/cmdline – command line (displayed in the header)

Arguments

ArgumentDescription
pid... (required, positional)One or more process IDs to display

Format selection

These flags are mutually exclusive. If none is specified, the default format is used.

FlagDescription
-x, --extendedShow extended format with RSS and Dirty columns (reads smaps)
-d, --deviceShow device format with Offset and Device columns

Display options

FlagDescription
-q, --quietSuppress header and footer lines
-p, --show-pathShow full file paths instead of basenames

Behavior

For each requested PID, pmap prints a header line (unless -q), followed by one line per memory mapping, and a footer with totals (unless -q).

PID:   command_name

Default mode

Columns: Address, Kbytes, Mode, Mapping.

Address           Kbytes Mode  Mapping
000055a4c8200000     152 r-x-- bash
000055a4c8425000       4 r---- bash
...
 total            123456K

The footer shows the total virtual size in kB.

Extended mode (-x)

Columns: Address, Kbytes, RSS, Dirty, Mode, Mapping.

Reads /proc/[pid]/smaps to obtain RSS and dirty page counts for each mapping. The footer shows totals for Kbytes, RSS, and Dirty.

Address           Kbytes     RSS   Dirty Mode  Mapping
000055a4c8200000     152     148       0 r-x-- bash
...
----------------  ------  ------  ------
total             123456   45678    1234K

Device mode (-d)

Columns: Address, Kbytes, Mode, Offset, Device, Mapping.

The Offset is the file offset of the mapping. The Device is the major:minor device number. The footer shows the mapped total, writeable/private total, and shared total.

Address           Kbytes Mode  Offset           Device    Mapping
000055a4c8200000     152 r-x-- 0000000000000000 008:00001 bash
...
mapped: 123456K    writeable/private: 2345K    shared: 6789K

Permission string format

Permissions are displayed as a 5-character string: rwxs- where:

  • r = readable (or -)
  • w = writable (or -)
  • x = executable (or -)
  • s = shared, - = private
  • Trailing -

Examples: r-x-- (read-execute, private), rw-s- (read-write, shared).

Mapping names

  • File-backed mappings show the file basename, or the full path with -p.
  • Anonymous mappings show [ anon ].
  • Stack regions show [ stack ].
  • Special kernel regions show [ vdso ], [ vvar ], [ vsyscall ], etc.

All output uses the cols crate for column alignment.

Exit codes

CodeMeaning
0All requested PIDs were displayed successfully
42One or more requested PIDs could not be found