When I was doing the great Laptop Switcharoo and modifying and upgrading systems in laptops, I wanted to check the configuration of RAM for the different systems.

Summary

English: This blog post provides a step-by-step guide to determine the RAM type (e.g., DDR4, 2400 MHz) on a Linux system using commands like dmidecode, lshw, and /proc/meminfo. These methods help users identify memory specifications for upgrades or troubleshooting.

Hindi: यह ब्लॉग पोस्ट लिनक्स सिस्टम पर RAM प्रकार (उदाहरण के लिए, DDR4, 2400 MHz) निर्धारित करने के लिए चरण-दर-चरण मार्गदर्शन प्रदान करता है, जिसमें dmidecode, lshw, और /proc/meminfo जैसे कमांड का उपयोग किया जाता है। ये विधियाँ उपयोगकर्ताओं को अपग्रेड या समस्या निवारण के लिए मेमोरी विनिर्देशों की पहचान करने में मदद करती हैं।

Problem Statement

Determining the type and speed of RAM installed in a Linux system is essential for tasks such as upgrading hardware, optimizing performance, or troubleshooting memory-related issues. Users need reliable methods to retrieve detailed memory specifications, such as DDR generation (e.g., DDR4) and clock speed (e.g., 2400 MT/s), without physically inspecting the hardware.

I had the following issue:

The Systems

Three computers had the following memory configurations:

The Goal

I needed to check what would be the best mix-and-match approach for optimizing the RAM performance. In particular, I was keen to set up 32 GB on the Dell Laptop, and 16 GB on the other computers, to get the advantage of dual channel on all laptops. That is how I ended up with the question:

How to Check RAM Type in Linux

Below is the response from grok (AI by X), summarized.

Using dmidecode

$ sudo dmidecode --type memory

This command provides detailed information about the installed RAM sticks, including:

Using lshw

$ sudo lshw -C memory

This command displays information about the memory controller and installed RAM, including:

Using free

$ free -h

This command shows the total and available memory, including swap space.

Sample Output

    # Example output from dmidecode
    Handle 0x000B, DMI type 16, 23 bytes: Memory Device
    Array Handle: 0x0009, Location: Bottom Slot of Top Side (left)
    Use: System Memory
    Memory Type: DDR4
    Capacity: 16 GB
    Speed: 3200 MHz
    Manufacturer: Kingston
    Part Number: KVR32S22S6/16

Explanation

These commands provide essential information about the type, speed, and capacity of RAM sticks installed in your system, helping you make informed decisions about upgrades and optimizations.

Methods to Check RAM Type

Method 1:

The dmidecode command retrieves hardware information from the system’s BIOS or UEFI firmware, making it the most reliable method for identifying RAM type and speed.

  1. Open a terminal.
  2. Run the following command with root privileges, as it requires administrative access:
    $ sudo dmidecode -t memory
  3. Review the output for sections labeled “Memory Device”. Look for:
    • Type: Indicates the DDR generation (e.g., DDR4).
    • Speed: Specifies the clock speed (e.g., 2400 MT/s).
    • Size: Shows the capacity of each module.

Example Output:

Handle 0x0020, DMI type 17, 84 bytes
Memory Device
    Size: 8192 MB
    Type: DDR4
    Speed: 2400 MT/s

Note: “MT/s” (mega transfers per second) is the standard unit for DDR RAM speed, though it is sometimes referred to as “MHz” in casual usage.

Method 2: The lshw (list hardware) command provides a detailed overview of system hardware, including memory specifications.

  1. Install lshw if it is not already present:
    $ sudo apt install lshw    # For Debian/Ubuntu-based systems
    $ sudo yum install lshw    # For Red Hat/CentOS-based systems
  2. Run the command with root privileges:
    $ sudo lshw -class memory
  3. Locate the “memory” class section. Look for entries under “bank” or “description” that specify the RAM type and speed.

Example Output:

*-memory
    description: System Memory
    *-bank:0
        description: DIMM DDR4 Synchronous 2400 MHz (0.4 ns)
        size: 8GiB

Method 3:

The /proc/meminfo file provides basic memory statistics but is limited in detailing RAM type or speed. It is primarily useful for confirming total memory size.

  1. Run the following command:
    $ cat /proc/meminfo | grep MemTotal
  2. Review the output, which shows the total memory but does not include DDR type or speed details.

Note: This method is less effective for identifying RAM specifications and is included for completeness.

Links and Resources

Recommendations

  • Preferred Tool: Use dmidecode for the most accurate and detailed RAM information, provided you have administrative access.
  • Cross-Verification: If the output is unclear or incomplete, verify with lshw or consult the system’s documentation or physical hardware labels.
  • Dependencies: Ensure required tools are installed. dmidecode is typically pre-installed, but lshw may need to be installed separately.

Conclusion

By using these commands, you can effectively check the type of RAM in your Linux system and optimize your memory configuration for better performance.