Understanding physical memory characteristics on a Linux system clarifies how much RAM is available, how it is used, and whether hardware matches expectations from vendor specifications or capacity planning.

The kernel tracks memory in pages and exposes aggregate statistics through interfaces such as /proc/meminfo, while user-space tools like free, top, and vmstat format these counters into human-readable summaries. Hardware-oriented utilities such as dmidecode read firmware data to reveal module size, type, speed, and manufacturer for each installed memory device.

Collecting information from several commands provides a fuller picture than relying on a single tool, especially on systems with swap, huge pages, or NUMA layouts. Some utilities require elevated privileges or may not be available in minimal containers, so attention to permissions, package availability, and environment (physical host versus virtual machine) avoids confusing partial outputs.

Steps to display memory details in Linux:

  1. Open a terminal with sudo privileges on the Linux system.
    $ whoami
    user

    Membership in the sudo or wheel group allows running privileged commands when needed.

  2. Display a quick summary of total, used, and available memory using the free command.
    $ free -h
                   total        used        free      shared  buff/cache   available
    Mem:            15Gi       2.3Gi       9.6Gi        221Mi       3.3Gi        12Gi
    Swap:          2.0Gi          0B       2.0Gi

    The Mem line shows physical RAM, while the Swap line shows configured swap space in a human-readable format.

  3. Inspect raw kernel memory statistics from /proc/meminfo for detailed counters in kilobytes.
    $ cat /proc/meminfo
    MemTotal:       15712000 kB
    MemFree:        10035200 kB
    MemAvailable:   12567000 kB
    Buffers:          512000 kB
    Cached:          3000000 kB
    SwapTotal:      2048000 kB
    SwapFree:       2048000 kB
    ##### snipped #####

    Fields such as MemAvailable and Cached help distinguish real pressure from simple file caching.

  4. Show hardware-level information about each installed memory device using dmidecode.
    $ sudo dmidecode --type memory
    # dmidecode 3.4
    Getting SMBIOS data from sysfs.
    SMBIOS 3.3.0 present.
    
    Handle 0x0038, DMI type 17, 84 bytes
    Memory Device
        Size: 8192 MB
        Form Factor: DIMM
        Type: DDR4
        Speed: 3200 MT/s
        Manufacturer: Samsung
        Serial Number: 1234567890
        Part Number: ABCD1234XYZ
    ##### snipped #####

    Running dmidecode requires root access and may expose serial numbers and other hardware identifiers that should not be shared publicly.

  5. List the memory block layout to see how RAM is divided into ranges and whether each block is online using lsmem when available.
    $ lsmem
    RANGE                                  SIZE  STATE REMOVABLE BLOCK
    0x0000000000000000-0x000000007fffffff  2G    online       no   0-15
    0x0000000100000000-0x000000047fffffff 14G    online       no  32-143
    
    Memory block size:       128M
    Total online memory:      16G
    Total offline memory:      0B

    If lsmem is not installed, install the util-linux package using the distribution package manager.

  6. Monitor live memory usage and process consumption using the top command.
    $ top
    top - 10:20:34 up  1:15,  2 users,  load average: 0.32, 0.44, 0.55
    Tasks: 199 total,   1 running, 198 sleeping,   0 stopped,   0 zombie
    %Cpu(s):  3.2 us,  1.3 sy,  0.0 ni, 94.5 id,  0.7 wa,  0.1 hi,  0.1 si,  0.0 st
    MiB Mem :  15712.0 total,  2350.5 used,  9847.2 free,   223.1 shared,  3514.3 buff/cache
    MiB Swap:  2048.0 total,     0.0 used,  2048.0 free

    Press Shift+M to sort processes by memory usage and q to quit top.

  7. Use htop for an interactive, colorized view of memory and processes when available.
    $ htop
      1  [||||||||||||||||||||||||||                      35.0%]   Tasks: 199, 1 running
    Mem[|||||                             2.34G/15.7G]
    Swp[                                  0K/2.0G]

    If htop is not present, install it using the distribution package manager, for example sudo apt install --assume-yes htop on Ubuntu.

  8. Display virtual memory statistics such as free memory, buffers, cache, and swap using vmstat.
    $ vmstat -s
         15712000 K total memory
          2350500 K used memory
          9847200 K active memory
           512000 K buffer memory
          3000000 K cache memory
          2048000 K total swap
                0 K used swap
          2048000 K free swap
    ##### snipped #####

    The snapshot from vmstat -s can be combined with repeated runs or logging to observe trends in memory pressure over time.

  9. Confirm that reported memory size matches expectations by summarizing totals again with free in gigabytes.
    $ free --giga
                  total        used        free      shared  buff/cache   available
    Mem:             15           2           9           0           3          12
    Swap:             2           0           2

    Minor differences between advertised capacity and reported size are normal because of reserved regions, but large discrepancies can indicate mis-seated modules or firmware limitations.

Discuss the article:

Comment anonymously. Login not required.