Linux Get Memory Slot Information
The lshw stands for List Hardware. It collects the detailed information of the hardware on your. I want to get the CPU and memory usage of a single process on Linux - I know the PID. Hopefully, I can get it every second and write it to a CSV using the 'watch' command. What command can I use to get this info from the Linux command-line? Once run, you can find information about memory at Memory and SPD tabs, where the memory slot selection will show you the available slots, used and free.
Most of the system administrators checks CPU & Memory utilization when they were facing some performance issue.
There is lot of utilities are available in Linux to check physical memory.These commands are help us to check the physical RAM present in system, also allow users to check memory utilization in varies aspect.
Most of us know only few commands and we are trying to include all the possible commands in this article.You may think, why I want to know all these commands instead of knowing some of the specific and routine commands.
Don’t think bad or don’t take in negative way because each one has different requirement and perception so, who’s looking for other purpose then this will very helpful for them.
What is RAM
Computer memory is a physical device which capable to store information temporarily or permanently. RAM stands for Random Access Memory is a volatile memory that stores information used by the operating system, software, and hardware.
Two types of memory is available.
- Primary Memory
- Secondary Memory
Primary memory is the main memory of the computer. CPU can directly read or write on this memory. It is fixed on the motherboard of the computer.
RAM:
Random Access Memory is a temporary memory. This information will go away when the computer is turned off.ROM:
Read Only Memory is permanent memory, that holds the data even if the system is switched off.
Method-1 : Using free Command
free displays the total amount of free and used physical and swap memory in the system, as well as the buffers and caches used by the kernel. The information is gathered by parsing /proc/meminfo.
Suggested Read : free – A Standard Command to Check Memory Usage Statistics (Free & Used) in Linux
Method-2 : Using /proc/meminfo file
/proc/meminfo is a virtual text file that contains a large amount of valuable information about the systems RAM usage.
It reports the amount of free and used memory (both physical and swap) on the system.
Method-3 : Using top Command
Top command is one of the basic command to monitor real-time system processes in Linux. It display system information and running processes information like uptime, average load, tasks running, number of users logged in, number of CPUs & cpu utilization, Memory & swap information. Run top command then hit E
to bring the memory utilization in MB.
Suggested Read : TOP Command Examples to Monitor Server Performance
Method-4 : Using vmstat Command
vmstat is a standard nifty tool that report virtual memory statistics of Linux system. vmstat reports information about processes, memory, paging, block IO, traps, and cpu activity. It helps Linux administrator to identify system bottlenecks while troubleshooting the issues.
Suggested Read : vmstat – A Standard Nifty Tool to Report Virtual Memory Statistics
Method-5 : Using nmon Command
nmon is a another nifty tool to monitor various system resources such as CPU, memory, network, disks, file systems, NFS, top processes, Power micro-partition and resources (Linux version & processors) on Linux terminal.
Just press m
key to see memory utilization stats (cached, active, inactive, buffered, free in MB & free percent)
Suggested Read : nmon – A Nifty Tool To Monitor System Resources On Linux
Method-6 : Using dmidecode Command
Dmidecode is a tool which reads a computer’s DMI (stands for Desktop Management Interface)
(some say SMBIOS – stands for System Management BIOS) table contents and display system hardware information in a human-readable format.
This table contains a description of the system’s hardware components, as well as other useful information such as serial number, Manufacturer information, Release Date, and BIOS revision, etc,.
Suggested Read :
Dmidecode – Easy Way To Get Linux System Hardware Information
Print only installed RAM modules.
Linux Get Memory Speed
Sum all the installed RAM modules.
Method-7 : Using hwinfo Command
hwinfo stands for hardware information tool is another great utility that used to probe for the hardware present in the system and display detailed information about varies hardware components in human readable format.
It reports information about CPU, RAM, keyboard, mouse, graphics card, sound, storage, network interface, disk, partition, bios, and bridge, etc,.
Suggested Read : hwinfo (Hardware Info) – A Nifty Tool To Detect System Hardware Information On Linux
Method-8 : Using lshw Command
lshw (stands for Hardware Lister) is a small nifty tool that generates detailed reports about various hardware components on the machine such as memory configuration, firmware version, mainboard configuration, CPU version and speed, cache configuration, usb, network card, graphics cards, multimedia, printers, bus speed, etc.
It’s generating hardware information by reading varies files under /proc directory and DMI table.
Suggested Read : LSHW (Hardware Lister) – A Nifty Tool To Get A Hardware Information On Linux
Method-9 : Using inxi Command
inxi is a nifty tool to check hardware information on Linux and offers wide range of option to get all the hardware information on Linux system that i never found in any other utility which are available in Linux. It was forked from the ancient and mindbendingly perverse yet ingenius infobash, by locsmif.
inxi is a script that quickly shows system hardware, CPU, drivers, Xorg, Desktop, Kernel, GCC version(s), Processes, RAM usage, and a wide variety of other useful information, also used for forum technical support & debugging tool.
Suggested Read : inxi – A Great Tool to Check Hardware Information on Linux
Method-10 : Using screenfetch Command
screenFetch is a bash script. It will auto-detect your distribution and display an ASCII art version of that distribution’s logo and some valuable information to the right.
Suggested Read : ScreenFetch – Display Linux System Information On Terminal With Distribution ASCII Art Logo
Method-11 : Using neofetch Command
Neofetch is a cross-platform and easy-to-use command line (CLI) script that collects your Linux system information and display it on the terminal next to an image, either your distributions logo or any ascii art of your choice.
Suggested Read : Neofetch – Shows Linux System Information With ASCII Distribution Logo
Method-12 : Using dmesg Command
dmesg (stands for display message or driver message) is a command on most Unix-like operating systems that prints the message buffer of the kernel.
Method-13 : Using atop Command
Atop is an ASCII full-screen system performance monitoring tool for Linux that is capable of reporting the activity of all server processes (even if processes have finished during the interval).
It’s logging of system and process activity for long-term analysis (By default, the log files are preserved for 28 days), highlighting overloaded system resources by using colors, etc. It shows network activity per process/thread with combination of the optional kernel module netatop.
Suggested Read : Atop – Monitor real time system performance, resources, process & check resource utilization history
Method-14 : Using htop Command
htop is an interactive process viewer for Linux which was developed by Hisham using ncurses library. Htop have many of features and options compared to top command.
Suggested Read : Monitor system resources using Htop command
Method-15 : Using corefreq Utility
CoreFreq is a CPU monitoring software designed for Intel 64-bits Processors and supported architectures are Atom, Core2, Nehalem, SandyBridge and superior, AMD Family 0F.
CoreFreq provides a framework to retrieve CPU data with a high degree of precision.
Suggested Read : CoreFreq – A Powerful CPU monitoring Tool for Linux Systems
Method-16 : Using glances Command
Glances is a cross-platform curses-based system monitoring tool written in Python. We can say all in one place, like maximum of information in a minimum of space. It uses psutil library to get information from your system.
Glances capable to monitor CPU, Memory, Load, Process list, Network interface, Disk I/O, Raid, Sensors, Filesystem (and folders), Docker, Monitor, Alert, System info, Uptime, Quicklook (CPU, MEM, LOAD), etc,.
Suggested Read : Glances (All in one Place)– An Advanced Real Time System Performance Monitoring Tool for Linux
Method-17 : Using gnome-system-monitor
System Monitor is a tool to manage running processes and monitor system resources. It shows you what programs are running and how much processor time, memory, and disk space are being used.
Finding RAM size details in Linux for a System admin is very easy task. We can use free command to check how much RAM is present in our system. But when you want to find how many RAM/Memory sa lots are present in your system is bit tricky one. One way to do open your system and check what sa lots are there and how much RAM. Instead of doing this as a Hardware engineer we can use a command to check which sa lot is having below details.
- How much RAM
- Speed of the RAM
- Maximum RAM supported by that machine
- RAM location etc.
As you are already aware of dmidecode command to get all the system hardware info. We will use the same command for getting our RAM details.
To Find RAM details like maximum RAM, location of RAM etc we can use -t option with dmidecode as shown below
dmidecode -t 16
Output:
# dmidecode 2.11
SMBIOS 2.7 present.
Handle 0x000F, 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
If you see the above output we can figure it out how much maximum RAM this machine support, number of RAM devices and location etc.
To get actual RAM details such as how many sa lots, actual RAM present etc, use -t 17 option in dmidecode command
dmidecode -t 17
Output:
# dmidecode 2.11
SMBIOS 2.7 present.
Handle 0x0010, DMI type 17, 34 bytes
Memory Device
Array Handle: 0x000F
Error Information Handle: 0x0011
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 0x0013, DMI type 17, 34 bytes
Memory Device
Array Handle: 0x000F
Error Information Handle: 0x0014
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
If we want to see complete RAM details we can use -t memory option to get the details. Note this is a combination of 16 and 17 options
Linux Get Memory Size
dmidecode -t memory
Output:
# dmidecode 2.11
SMBIOS 2.7 present.
Handle 0x000F, 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 0x0010, DMI type 17, 34 bytes
Memory Device
Array Handle: 0x000F
Error Information Handle: 0x0011
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 0x0013, DMI type 17, 34 bytes
Memory Device
Array Handle: 0x000F
Error Information Handle: 0x0014
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
Some of the valid keywords/types you can use and find different details are as follows.
bios
system
baseboard
chassis
processor
memory
cache
connector
sa lot
We can even use lshw command to get RAM/Memory details as well Cache details such as L1, L2 and L3 levels.
lshw -class memory
*-firmware
description: BIOS
vendor: Hewlett-Packard
physical id: 0
version: F.22
date: 07/27/2011
size: 1MiB
capacity: 2496KiB
capabilities: pci upgrade shadowing cdboot bootselect edd int13floppynec int13floppytoshiba int13floppy360 int13floppy1200 int13floppy720 int13floppy2880 int9keyboard int10video acpi usb biosbootspecification uefi
*-memory
description: System Memory
physical id: f
sa lot: System board or motherboard
size: 8GiB
*-bank:0
description: SODIMM DDR3 Synchronous 1333 MHz (0.8 ns)
product: 99U5428-046.A00LF
vendor: Kingston
physical id: 0
serial: 4B29A74B
sa lot: DIMM0
size: 4GiB
width: 64 bit’s
clock: 1333MHz (0.8ns)
*-bank:1
description: SODIMM DDR3 Synchronous 1333 MHz (0.8 ns)
product: 99U5428-046.A00LF
vendor: Kingston
physical id: 1
serial: 4729BF4B
sa lot: DIMM1
size: 4GiB
width: 64 bit’s
clock: 1333MHz (0.8ns)
*-cache:0
description: L1 cache
physical id: 1c
sa lot: L1 Cache
size: 32KiB
capacity: 32KiB
capabilities: synchronous internal write-through instruction
*-cache:1
description: L2 cache
physical id: 1d
sa lot: L2 Cache
size: 256KiB
capacity: 256KiB
capabilities: synchronous internal write-through unified
*-cache:2
description: L3 cache
physical id: 1e
sa lot: L3 Cache
size: 3MiB
capacity: 3MiB
capabilities: synchronous internal write-through unified
*-cache
description: L1 cache
physical id: 1b
sa lot: L1 Cache
size: 32KiB
capacity: 32KiB
capabilities: synchronous internal write-through data
Linux Get Memory Slot Information Free
Do let us know if there is any way to find RAM sa lot details.
The following two tabs change content below.- Docker: How to copy files to/from docker container - June 30, 2020
- Anisble: ERROR! unexpected parameter type in action:
Fix - June 29, 2020 - FREE: JOIN OUR DEVOPS TELEGRAM GROUPS - August 2, 2019
- Review: Whizlabs Practice Tests for AWS Certified Solutions Architect Professional (CSAP) - August 27, 2018
- How to use ohai/chef-shell to get node attributes - July 19, 2018