Posted in

How to Check RAM in Linux: Easy Guide for Users (Ubuntu, CentOS, etc.)

Linux is widely used in India by students, software developers, system administrators, and IT professionals — especially on Ubuntu, which is very popular for learning, coding, and servers. Knowing how much RAM (Random Access Memory) your system has and how much is being used is essential for:

  • Checking if your laptop or server has enough memory for programming, video editing, or running multiple apps.
  • Troubleshooting slow performance or high memory usage.
  • Upgrading RAM or buying a new system.
  • Monitoring servers on AWS, DigitalOcean, or local VPS.
  • Preparing for interviews (a very common Linux question).

Here is step-by-step instructions. It works on most Linux distributions like Ubuntu, Linux Mint, Fedora, and CentOS.

 RAM in Linux

Why Check RAM Usage?

  • Linux systems can slow down when RAM is full (it starts using Swap memory).
  • Developers need to ensure their apps don’t consume too much memory.
  • Students running virtual machines (VMware, VirtualBox) or Docker containers must monitor RAM.
  • System admins prevent crashes on production servers.

1. Check RAM Using free Command (Easiest & Most Popular)

This is the quickest method used by most  developers.

  1. Open the Terminal (Ctrl + Alt + T on Ubuntu).
  2. Type the following command and press Enter:
    Bash
  3. free -h

Sample Output:

total        used        free      shared  buff/cache   available

Mem:           7.7Gi       2.1Gi       3.2Gi       456Mi       2.4Gi       5.1Gi

Swap:          2.0Gi       0B          2.0Gi

  • total: Total installed RAM (e.g., 7.7Gi means about 8GB).
  • used: Currently used RAM.
  • free: Completely free RAM.
  • available: RAM available for new applications.

Useful variations:

Bash

free -h -s 2     # Refresh every 2 seconds

free -h -t       # Show total at the bottom

2. Check Detailed RAM Information (/proc/meminfo)

Bash

cat /proc/meminfo

Look for these lines:

  • MemTotal: → Total physical RAM
  • MemFree: → Free RAM
  • MemAvailable: → Available for new programs

One-liner for total RAM only: Bash grep MemTotal /proc/meminfo

3. Check RAM Using top and htop (Live Monitoring)

  • top (pre-installed):
    Bash
  • top
  • Press Shift + M to sort by memory usage. Press q to quit.
  • htop (more user-friendly — recommended):
    Bash

sudo apt update && sudo apt install htop -y    # Ubuntu / Debian

  • htop
  • You will see a colorful interface showing RAM usage at the top.

4. Check Hardware RAM Details (Total Installed RAM)

Using lshw:

Bash

sudo apt install lshw -y

sudo lshw -short -C memory

Using dmidecode (Most Accurate):

Bash sudo apt install dmidecode -y

sudo dmidecode –type memory | grep -E “Size|Speed|Manufacturer”

This shows RAM size, speed, slots used, manufacturer, etc. Very useful when upgrading RAM.

5. GUI Methods (For Beginners)

  • Ubuntu Desktop: Go to Settings → About → You will see Memory (total RAM).
  • GNOME System Monitor:
    Bash
  • gnome-system-monitor
  • Go to the Resources
  • Mate / Cinnamon / KDE: Search for “System Monitor” in the menu.

6. Check RAM on Servers / Cloud (Common in India)

  • AWS EC2 / DigitalOcean Droplet: Use the same free -h or htop commands.
  • Check Swap Memory:
    Bash
  • swapon –show
  • Memory Usage by Processes:
    Bash
  • ps aux –sort=-%mem | head -n 10

Common Troubleshooting & Tips

  • RAM looks less than installed? Linux uses some memory for caching (this is normal and good for performance). Check available column.
  • High memory usage? Identify culprit processes with htop or:
    Bash
  • sudo apt install glances -y && glances
  • Add Swap if RAM is low: Many users on low-RAM laptops (4GB–8GB) create swap space.
  • Multiple Sticks of RAM? dmidecode shows details of each slot.
  • Permission issues? Always use sudo for hardware commands.
  • Old Linux version? Update your system:
    Bash
  • sudo apt update && sudo apt upgrade -y

Extra Tips for  Users

  • Students & Beginners: Start with free -h and htop. Practice on Ubuntu in VirtualBox.
  • Developers: Monitor RAM while running Node.js, Python, Java, or Android Studio projects.
  • Interview Preparation: Be ready to explain free, /proc/meminfo, and dmidecode.
  • Low-End Laptops: Common in India (4GB–8GB RAM). Close unnecessary browser tabs and use lightweight desktop environments like XFCE.
  • Servers: Use tools like Prometheus + Grafana for advanced monitoring in production.
  • Upgrading RAM: Check maximum supported RAM using dmidecode before buying from local markets or Amazon/Flipkart.
  • Performance Boost: Use zram for better memory compression on low-RAM machines.

Conclusion

Checking RAM in Linux is fast and simple. The most useful commands to remember are:

  • free -h → Quick overview
  • htop → Live monitoring
  • sudo dmidecode –type memory → Hardware details

Save this article or take screenshots of the commands. Practice them on your system today. Whether you are learning Linux for college, preparing for jobs, or managing servers, these skills are very valuable.

Share this guide with your friends, classmates, or colleagues in WhatsApp groups. Mastering basic Linux commands like these will boost your confidence and productivity.