When a Linux server begins experiencing severe performance degradation or Kernel Panic errors related to out-of-memory (OOM) killer events, system administrators often rely on the free or top commands to monitor RAM usage. However, those commands only show you how the operating system is currently allocating the memory; they do not show you the actual physical hardware layout. If you need to verify how many physical RAM sticks are installed, their block sizes, and whether any memory banks are offline or failing, you must use the lsmem command.
How to Read the Standard Output
The lsmem (list memory) utility queries the system’s sysfs architecture to provide a structured table of the physical memory blocks recognized by the kernel.
To view the default report, simply run:
lsmem
The terminal will output a table divided into several sections. The most critical information is presented at the top:
- RANGE: This shows the hexadecimal memory addresses (e.g.,
0x0000000000000000-0x000000003fffffff). This represents a physical block of RAM on the motherboard. - SIZE: This indicates the total physical capacity of that specific memory block (e.g.,
1Gor512M). - STATE: This is the most important diagnostic column. It will usually say
online. If a memory bank is physically damaged, improperly seated, or disabled in the BIOS, this column will clearly sayoffline. - REMOVABLE: This indicates whether the Linux kernel believes this block of memory can be safely hot-swapped (removed while the server is running). On enterprise servers, this might say
yes. On a standard desktop PC, it will almost always sayno.
Summarizing the System Memory
At the very bottom of the lsmem output, you will find a highly useful “Memory block size” and “Total online memory” summary. This summary is far more accurate than the free command when verifying that the system actually detects all the physical hardware you installed.
For example, if you physically installed 32GB of RAM into the motherboard, but the “Total online memory” only reports 16GB, you immediately know that the system is completely failing to recognize half of your hardware, indicating a faulty motherboard slot, a dead RAM stick, or a severe BIOS configuration issue rather than a software bug.
To view the output in raw bytes rather than human-readable gigabytes (useful for scripting), append the -b (bytes) flag:
lsmem -b