LSMEMSection: User Commands (1)
Index | Return to Main Contents
NAMElsmem - list the ranges of available memory with their online status
The lsmem command 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.
The default output compatible with original implementation from s390-tools, but it's strongly recommended to avoid using default outputs in your scripts. Always explicitly define expected columns by using the --output option together with a columns list in environments where a stable output is required.
The lsmem command lists a new memory range always when the current memory block distinguish from the previous block by some output column. This default behavior is possible to override by the --split option (e.g., lsmem --split=ZONES). The special word "none" may be used to ignore all differences between memory blocks and to create as large as possible continuous ranges. The opposite semantic is --all to list individual memory blocks.
Note that some output columns may provide inaccurate information if a split policy forces lsmem to ignore differences in some attributes. For example if you merge removable and non-removable memory blocks to the one range than all the range will be marked as non-removable on lsmem output.
Not all columns are supported on all systems. If an unsupported column is specified, lsmem prints the column but does not provide any data for it.
- List each individual memory block, instead of combining memory blocks with similar attributes.
- Print the SIZE column in bytes rather than in a human-readable format.
- Display help text and exit.
- Use JSON output format.
- Do not print a header line.
-o, --output list
- Specify which output columns to print. Use --help to get a list of all supported columns. The default list of columns may be extended if list is specified in the format +list (e.g., lsmem -o +NODE).
- Output all available columns.
- Produce output in the form of key="value" pairs. All potentially unsafe value characters are hex-escaped (\x<code>).
- Produce output in raw format. All potentially unsafe characters are hex-escaped (\x<code>).
-S, --split list
- Specify which columns (attributes) use to split memory blocks to ranges. The supported columns are STATE, REMOVABLE, NODE and ZONES, or "none". The other columns are silently ignored. For more details see DESCRIPTION above.
-s, --sysroot directory
- Gather memory data for a Linux instance other than the instance from which the lsmem command is issued. The specified directory is the system root of the Linux instance to be inspected.
- Display version information and exit.
- This option controls summary lines output. The optional argument when can be never, always or only. If the when argument is omitted, it defaults to "only". The summary output is suppressed for --raw, --pairs and --json.
For bug reports, use the issue tracker at <https://github.com/karelzak/util-linux/issues>.
The lsmem command is part of the util-linux package which can be downloaded from Linux Kernel Archive <https://www.kernel.org/pub/linux/utils/util-linux/>.
Return to Main Contents