lsmem

List the ranges of available memory with their online status

TLDR

List memory information
$ lsmem
List all individual memory blocks
$ lsmem --all
Output as JSON
$ lsmem --json
Show sizes in bytes
$ lsmem --bytes
Show only the summary
$ lsmem --summary=only
Select specific output columns
$ lsmem --output [RANGE,SIZE,STATE,REMOVABLE]

SYNOPSIS

lsmem [options]

DESCRIPTION

lsmem lists the ranges of available memory with their online status. The listed memory blocks correspond to the memory block representation in sysfs. The command also shows the memory block size and the amount of memory in online and offline state. Part of util-linux.

PARAMETERS

-J, --json

Output in JSON format
-b, --bytes
Print sizes in bytes
-o, --output COLUMNS
Specify output columns
-a, --all
Show all memory blocks
-n, --noheadings
Suppress column headers
-r, --raw
Raw output without formatting
--summary [WHEN]
Control summary output: never, always, only.
-S, --split LIST
Columns to split memory blocks: STATE, REMOVABLE, NODE, ZONES, or none.
-s, --sysroot DIR
Gather memory data for another Linux instance.
-P, --pairs
Produce key="value" output, suitable for shell `eval`.
-h, --help, -V, --version
Show help or version information.

INSTALL

sudo apt install util-linux
sudo dnf install util-linux
sudo pacman -S util-linux
sudo apk add util-linux-misc
sudo zypper install util-linux
brew install util-linux
nix profile install nixpkgs#util-linux

CAVEATS

Only available on Linux. Requires sysfs to be mounted. Shows kernel's view of memory, not physical DIMM information.

SEE ALSO

free(1), chmem(8), dmidecode(8)