LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

lsmem

List the ranges of available memory with their online status

TLDR

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

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
copy
sudo dnf install util-linux
copy
sudo pacman -S util-linux
copy
sudo apk add util-linux-misc
copy
sudo zypper install util-linux
copy
brew install util-linux
copy
nix profile install nixpkgs#util-linux
copy

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)

Copied to clipboard
Kai