This is our sixth post on getting hardware information. In this post we will see how to get RAM details such as size, speed, make, maximum capacity allowed RAM etc. We already covered some hardware related stuff in this series so far as given below.
Get BIOS, Firmware, Hardware And Drivers Details in Linux/Unix

What is dmesg command and how to use it in Linux/Unix?

Find hardware info with lshw, hardinfo, sysinfo Linux/Unix commands

Find PCI hardware details using lspci command in Linux

Find USB device details in Linux/Unix using lsusb command

Find RAM details in Linux

Example1: Find RAM size(Total, available, used) in Linux. We can use below five methods to get details.
free

Want to understand free command output? check our post on free command.

Output:

             total       used       free     shared    buffers     cached
Mem:       8027952    4108280    3919672          0     132180    1646004
-/+ buffers/cache:    2330096    5697856
Swap:     15624188     573224   15050964

top

Check our excelent post to understand Linux top command output.

Output:

Top command RAM details

cat /proc/meminfo

Output:

MemTotal:        8027952 kB
MemFree:         3893748 kB
Buffers:          132208 kB
Cached:          1666864 kB
SwapCached:       226556 kB
Active:          1979556 kB
Inactive:        1849480 kB
Active(anon):    1592580 kB
Inactive(anon):   886080 kB
Active(file):     386976 kB
Inactive(file):   963400 kB
Unevictable:          68 kB
Mlocked:              68 kB
SwapTotal:      15624188 kB
SwapFree:       15050964 kB
Dirty:               172 kB
Writeback:             0 kB
AnonPages:       1907548 kB
Mapped:           223484 kB
Shmem:            448696 kB
Slab:             140444 kB
SReclaimable:     101456 kB
SUnreclaim:        38988 kB
KernelStack:        4960 kB
PageTables:        53108 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:    19638164 kB
Committed_AS:    7822876 kB
VmallocTotal:   34359738367 kB
VmallocUsed:      567356 kB
VmallocChunk:   34359151824 kB
HardwareCorrupted:     0 kB
AnonHugePages:         0 kB
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
DirectMap4k:      120832 kB
DirectMap2M:     8118272 kB
vmstat -s

Output:

      8027952 K total memory
      4114688 K used memory
      1960100 K active memory
      1849792 K inactive memory
      3913264 K free memory
       132240 K buffer memory
      1667108 K swap cache
     15624188 K total swap
       573224 K used swap
     15050964 K free swap
       931285 non-nice user cpu ticks
         6391 nice user cpu ticks
       152567 system cpu ticks
      7019826 idle cpu ticks
       181109 IO-wait cpu ticks
           19 IRQ cpu ticks
         2262 softirq cpu ticks
            0 stolen cpu ticks
      8720641 pages paged in
      8812796 pages paged out
       148645 pages swapped in
       242381 pages swapped out
     27774146 interrupts
     71720320 CPU context switches
   1369757470 boot time
       463603 forks

dmidecode –type memory
or
dmidecode -t 17

Output:

# dmidecode 2.11
SMBIOS 2.7 present.
Handle 0x000E, DMI type 16, 23 bytes
Physical Memory Array
    Location: System Board Or Motherboard
    Use: System Memory
    Error Correction Type: None
    Maximum Capacity: 16 GB
    Error Information Handle: No Error
    Number Of Devices: 2
Handle 0x000F, DMI type 17, 34 bytes
Memory Device
    Array Handle: 0x000E
    Error Information Handle: 0x0010
    Total Width: 64 bit's
    Data Width: 64 bit's
    Size: 4096 MB
    Form Factor: SODIMM
    Set: None
    Locator: DIMM0
    Bank Locator: BANK 0
    Type: DDR3
    Type Detail: Synchronous
    Speed: 1333 MHz
    Manufacturer: Kingston
    Serial Number: 4B29A74B
    Asset Tag: 0123456789
    Part Number: 99U5428-046.A00LF 
    Rank: Unknown
    Configured Clock Speed: 1333 MHz
Handle 0x0012, DMI type 17, 34 bytes
Memory Device
    Array Handle: 0x000E
    Error Information Handle: 0x0013
    Total Width: 64 bit's
    Data Width: 64 bit's
    Size: 4096 MB
    Form Factor: SODIMM
    Set: None
    Locator: DIMM1
    Bank Locator: BANK 2
    Type: DDR3
    Type Detail: Synchronous
    Speed: 1333 MHz
    Manufacturer: Kingston
    Serial Number: 4729BF4B
    Asset Tag: 0123456789
    Part Number: 99U5428-046.A00LF 
    Rank: Unknown
    Configured Clock Speed: 1333 MHz

Example 2: Get RAM information like location, Maximum capacity of RAM supported, number of RAM devices present and sa lot info.

dmidecode -t 16

Output:

# dmidecode 2.11
SMBIOS 2.7 present.
Handle 0x000E, DMI type 16, 23 bytes
Physical Memory Array
    Location: System Board Or Motherboard
    Use: System Memory
    Error Correction Type: None
    Maximum Capacity: 16 GB
    Error Information Handle: No Error
    Number Of Devices: 2

Example 3: Find RAM information like Type of RAM(SD RAM or DDR2/3), Speed, Manufacture etc

dmidecode -t 17

Output:

# dmidecode 2.11
SMBIOS 2.7 present.
Handle 0x000F, DMI type 17, 34 bytes
Memory Device
    Array Handle: 0x000E
    Error Information Handle: 0x0010
    Total Width: 64 bit's
    Data Width: 64 bit's
    Size: 4096 MB
    Form Factor: SODIMM
    Set: None
    Locator: DIMM0
    Bank Locator: BANK 0
    Type: DDR3
    Type Detail: Synchronous
    Speed: 1333 MHz
    Manufacturer: Kingston
    Serial Number: 4B29A74B
    Asset Tag: 0123456789
    Part Number: 99U5428-046.A00LF 
    Rank: Unknown
    Configured Clock Speed: 1333 MHz
Handle 0x0012, DMI type 17, 34 bytes
Memory Device
    Array Handle: 0x000E
    Error Information Handle: 0x0013
    Total Width: 64 bit's
    Data Width: 64 bit's
    Size: 4096 MB
    Form Factor: SODIMM
    Set: None
    Locator: DIMM1
    Bank Locator: BANK 2
    Type: DDR3
    Type Detail: Synchronous
    Speed: 1333 MHz
    Manufacturer: Kingston
    Serial Number: 4729BF4B
    Asset Tag: 0123456789
    Part Number: 99U5428-046.A00LF 
    Rank: Unknown
    Configured Clock Speed: 1333 MHz

In our next post in this series we will see BIOS and Processer details.

The following two tabs change content below.
Mr Surendra Anne is from Vijayawada, Andhra Pradesh, India. He is a Linux/Open source supporter who believes in Hard work, A down to earth person, Likes to share knowledge with others, Loves dogs, Likes photography. He works as Devops Engineer with Taggle systems, an IOT automatic water metering company, Sydney . You can contact him at surendra (@) linuxnix dot com.