Determine system RAM without physical inspection using command line tools. This method works for scripting and remote system administration when memory capacity is unknown.
Requirements
- Linux system with terminal access
- Basic command line knowledge
- Root privileges for certain commands
Check RAM in Linux
Using the free Command
Run the following command to display memory usage:
$ free -h
The output shows total, used, and available memory:
total used free shared buff/cache available
Mem: 15Gi 2.1Gi 10Gi 421Mi 3.2Gi 12Gi
Swap: 0B 0B 0B
The total column displays installed RAM. Use -m for megabytes or -g for gigabytes.
-w flag to separate buffers and cache into distinct columns for detailed analysis.
Using /proc/meminfo
Read memory information directly from the system file:
$ grep MemTotal /proc/meminfo
The command returns:
MemTotal: 16384000 kB
This value represents total physical memory in kilobytes.
Using vmstat Command
Display memory statistics with vmstat:
$ vmstat -s
Find the total memory line in the output:
16384000 K total memory
2195456 K used memory
3276800 K active memory
Extract only total memory with grep:
$ vmstat -s | grep 'total memory'
Using top Command
Launch the interactive process viewer:
$ top
View memory statistics in the header section:
MiB Mem : 16000.0 total, 10234.5 free, 2100.3 used, 3665.2 buff/cache
Press q to exit top.
E in top to cycle through memory unit displays (KiB, MiB, GiB, TiB).
Using dmidecode Command
Access detailed hardware information with root privileges:
# dmidecode -t memory | grep Size
The output displays physical memory module details:
Size: 8192 MB
Size: 8192 MB
Size: No Module Installed
Size: No Module Installed
This shows installed RAM modules and empty slots.
Using lshw Command
Generate comprehensive hardware information:
# lshw -short -C memory
View memory class devices and capacity:
H/W path Device Class Description
======================================================
/0/0 memory 64KiB BIOS
/0/1 memory 16GiB System Memory
/0/1/0 memory 8GiB DIMM DDR4 2400 MHz
/0/1/1 memory 8GiB DIMM DDR4 2400 MHz
Filter for system memory total:
# lshw -C memory | grep size
Comparing RAM Check Methods
| Command | Detail Level | Root Required | Best For |
|---|---|---|---|
free |
Basic | No | Quick memory check |
/proc/meminfo |
Detailed | No | Scripting and automation |
vmstat |
Moderate | No | Memory statistics |
top |
Real-time | No | Live monitoring |
dmidecode |
Hardware | Yes | Physical module info |
lshw |
Hardware | Yes | Complete hardware scan |
FAQS
Use free -h or cat /proc/meminfo commands. Both display total RAM without requiring root privileges for system administration.
Run free -h for immediate results. The command displays total memory in human-readable format within seconds across all distributions.
Execute sudo dmidecode -t memory to view detailed information about installed RAM modules including size, speed, and slot configuration.
No, free only displays memory capacity and usage. Use dmidecode or lshw commands to check RAM speed and type.
Use top or htop commands for real-time monitoring. Both update memory statistics automatically and display process-level RAM consumption continuously.

