17 Ways To Check Size Of Physical Memory (RAM) In Linux
======
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][1]
```
$ free -m
total used free shared buff/cache available
Mem: 1993 1681 82 81 228 153
Swap: 12689 1213 11475
$ free -g
total used free shared buff/cache available
Mem: 1 1 0 0 0 0
Swap: 12 1 11
```
### 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’s report the amount of free and used memory (both physical and swap) on the system.
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][2]
```
$ top
top - 14:38:36 up 1:59, 1 user, load average: 1.83, 1.60, 1.52
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][3]
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][4]
```
┌nmon─14g──────[H for help]───Hostname=2daygeek──Refresh= 2secs ───07:24.44─────────────────┐
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][5]
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][6]
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][7]
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][8]
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][9]
```
$ screenfetch
./+o+- [emailprotected]
yyyyy- -yyyyyy+ OS: Ubuntu 17.10 artful
://+//////-yyyyyyo Kernel: x86_64 Linux 4.13.0-37-generic
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][10]
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][11]
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][12]
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][13]
```
$ ./corefreq-cli -k
Linux:
|- Release [4.13.0-37-generic]
|- Version [#42-Ubuntu SMP Wed Mar 7 14:13:23 UTC 2018]
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][14]
```
$ glances
ubuntu (Ubuntu 17.10 64bit / Linux 4.13.0-37-generic) - IP 192.168.1.6/24 Uptime: 1:08:40
CPU [|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 90.6%] CPU - 90.6% nice: 0.0% ctx_sw: 4K MEM \ 78.4% active: 942M SWAP - 5.9% LOAD 2-core
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.