If you’re using Linux and need to check your RAM size, there are plenty of simple ways to get the information. Whether you’re troubleshooting performance issues, checking compatibility for new software, or just curious about your hardware, these methods will help you out. In this guide, we’ll walk through several ways to check your system’s RAM size using Linux commands and tools.
Table of Contents
1. Check RAM with the free
Command
The free
command is one of the fastest ways to see memory usage on a Linux system. Open your terminal and type:
free -h
The -h
flag makes the output easier to read by showing memory values in MB or GB instead of raw bytes. You’ll see columns for total, used, free, shared, buffer/cache, and available memory. It’s a quick snapshot of how your RAM is being utilized.
2. Check RAM size using the vmstat
Command
If you want a more detailed breakdown, try the vmstat
command. It reports on system performance, including memory usage. Run this in your terminal:
vmstat -s
This will output a long list of memory statistics, such as total memory, free memory, and swap usage. It’s a handy tool for understanding how your system is performing.
3. Check RAM size by reading /proc/meminfo
Your Linux system keeps a detailed record of memory information in the /proc/meminfo
file. To view this file, run:
cat /proc/meminfo
Look for the line labeled MemTotal
. It shows your system’s total memory in kilobytes. This file contains additional details about memory allocation, including available memory, cached memory, and more.
4. Use the top
Command for Real-Time Stats
The top
command provides a live view of your system’s performance. To see memory usage, type:
top
At the top of the output, you’ll see memory stats, including total, used, and free memory. This command is especially useful if you want to monitor how memory usage changes in real time as you run programs.
5. Install and Run htop
for a User-Friendly View
If you prefer a more visual interface, try htop
. It’s an interactive process viewer that’s easier to navigate than top
. To install it, use the following commands:
For Ubuntu/Debian-based systems:
sudo apt install htop
For Red Hat-based systems:
sudo yum install htop
Once installed, run:
htop
You’ll see a colorful, real-time display of system stats, including memory usage. It’s great for users who prefer a more intuitive interface.
6. Use dmidecode
for Hardware Details
The dmidecode
command provides detailed hardware information, including data about your physical RAM. Run this command with superuser privileges:
sudo dmidecode --type memory
You’ll see a list of memory modules installed in your system, including size, type, and speed. This is especially useful if you’re planning to upgrade your RAM and need specific details about your current setup.
7. Check Memory with lshw
The lshw
(list hardware) command offers another way to see memory details. To focus on memory information, use:
sudo lshw -class memory
This will display detailed information about your RAM, including the total size and configuration of memory slots. It’s a helpful tool if you’re troubleshooting or planning upgrades.
8. Use inxi
for a Complete System Summary
The inxi
tool is a one-stop solution for system information, including memory. Install it with:
For Ubuntu/Debian systems:
sudo apt install inxi
For Red Hat-based systems:
sudo yum install inxi
Once installed, type:
inxi -m
You’ll get a summary of your system’s memory, including total RAM, usage, and swap space.
FAQs
How do I check total RAM in Linux?
Use the free -h
or cat /proc/meminfo
commands. These are quick and reliable ways to check your total memory.
Which command shows real-time memory usage?
The top
and htop
commands are excellent for monitoring live memory usage.
Can I see RAM details like speed and type?
Yes, run sudo dmidecode --type memory
to get detailed information about your RAM modules, including speed, size, and type.
What is the easiest way to find RAM size in Linux?
The free -h
command is the simplest and most user-friendly method to check your RAM size.
With these tools and commands, you can easily check the RAM size on any Linux system. Whether you’re troubleshooting, upgrading, or just curious, there’s a method here for everyone.
Helpful, thank you!
the same thing we can do including with command like
$top
but i find this article very helpful also
Thanks
Helpful
THanks
using
$free command also we can get the physical memory.
ex: [root@Func-22 ~]# free
total used free shared buffers cached
Mem: 2055668 1940780 114888 0 298060 438004
-/+ buffers/cache: 1204716 850952
Swap: 4128760 8 4128752
Here Mem: 2055668 is the physical memory….
jai.