Linux / Ubuntu

Show RAM Usage Ubuntu: 6 Commands That Actually Work

From a single quick command to real-time process monitoring — here's how to see exactly what's eating your memory.

January 20256 min read
Ubuntu terminal showing RAM usage output with free -h and htop commands
Quick Answer

Run free -h in the terminal to see RAM usage instantly. For a live view with per-process breakdown, use htop. The "available" column in free -h is the number that actually matters — not "free".

What's in this guide

  1. The 6 Commands You Need
  2. Reading the Output Correctly
  3. What Normal RAM Usage Looks Like
  4. Quick Fixes for High RAM Usage
  5. The Overlooked Cause Most People Miss
  6. What Not to Do
  7. Decision Flowchart
  8. If You Only Do One Thing
  9. FAQ

The 6 Commands You Need

You opened a terminal. Good. Here's what to run, in order of usefulness:

1. free -h (fastest overview)

# Shows RAM in human-readable format (GB/MB) free -h

This is your go-to. It shows total, used, free, shared, buffer/cache, and available memory in one line.

2. htop (live monitoring)

# Install if not present sudo apt install htop htop

Press M inside htop to sort by memory usage. Press F10 or q to quit. This gives you live per-process RAM consumption — far more useful than a snapshot.

3. vmstat -s (detailed memory stats)

vmstat -s | grep -i mem

4. Top 10 processes by RAM

ps aux --sort=-%mem | head -10

5. /proc/meminfo (raw kernel data)

cat /proc/meminfo | grep -E "MemTotal|MemFree|MemAvailable|Cached|SwapUsed"

6. smem (per-process with shared memory)

# More accurate than ps for shared libraries sudo apt install smem smem -t -k | tail -5

According to the Linux kernel documentation, /proc/meminfo's MemAvailable field provides an estimate of how much memory is available for starting new applications without swapping[source] — which is more useful than "MemFree" in most practical situations.

Ubuntu RAM Commands — Speed vs Depth free -h Instant snapshot htop Live + per-process ps aux --sort Ranked process list smem Most accurate, slowest

Reading the Output Correctly

Here's what free -h actually outputs and what each column means:

total used free shared buff/cache available Mem: 15Gi 4.2Gi 6.8Gi 512Mi 4.0Gi 10Gi Swap: 2.0Gi 0B 2.0Gi

The column people get wrong most often is "free". 6.8GB looks great — but it doesn't mean 6.8GB is actually available for your next app. Linux aggressively uses spare RAM as disk cache. That's by design, and it's a good thing.

The number that matters is "available" — 10Gi in this example. That's what Linux will hand to a new process if it needs it. Free + most of the buffer/cache. So don't panic when "free" looks low.

SymptomLikely CauseFix Difficulty
available RAM under 500MBToo many processes, memory leakMedium
Swap in use heavilyRAM genuinely exhausted, Linux swappingMedium–Hard
One process using >2GB unexpectedlyMemory leak or runaway processEasy (kill it)
RAM usage spikes then dropsNormal cache behaviorNone needed
System sluggish despite low "used" valueSwap thrashingMedium
🔍 RAM Problem Checklist
Check what's true on your system right now:

What Normal RAM Usage Looks Like on Ubuntu

Fair warning: "normal" varies a lot by your desktop environment. Here are rough idle baselines:

Ubuntu Version / DesktopTypical Idle RAMNotes
Ubuntu Server (no GUI)150–300MBMinimal services only
Ubuntu Desktop (GNOME)1.5–2.5GBGNOME Shell is heavy
Xubuntu (XFCE)500–900MBLightweight desktop
Lubuntu (LXQt)300–600MBVery light
Ubuntu with browser open3–5GB typicalChromium is the biggest factor

Microsoft's documentation on Windows Subsystem for Linux notes that Ubuntu 22.04 running under WSL2 uses approximately 400–600MB at idle[source], which gives a useful comparison baseline for headless Ubuntu usage.

🛠 RAM Diagnostic Tool

What does your "available" column show in free -h?

Quick Fixes for High RAM Usage

Quick Wins (2 minutes)

Drop the page cache manually: If RAM looks full but it's mostly cache, you can force Linux to release it: sudo sh -c 'echo 3 > /proc/sys/vm/drop_caches'. This is safe and temporary.

Kill the heaviest process: Find the PID in htop, press k, then Enter to kill it. For a browser, just close the tabs instead.

Disable unused startup services: Run systemctl list-units --type=service --state=running and disable anything you don't recognize or need.

Deeper Fixes

Increase your swap space: If you're consistently running out of RAM, a larger swap file buys time. Ubuntu's official documentation recommends swap of at least equal size to RAM for systems with 2GB or less physical memory[source].

Switch to a lighter desktop: GNOME uses roughly 3x more RAM than XFCE at idle. If you're on an older machine, switching desktops is the single biggest RAM win available.

Profile memory leaks: Use valgrind or the built-in top with repeated snapshots to catch processes that grow over time without releasing memory.

The Overlooked Cause Most People Miss

Journald — the system logging daemon — can quietly consume hundreds of megabytes of RAM if it's set to keep logs in memory. On servers that run for weeks without a reboot, this adds up.

Check it with: journalctl --disk-usage. If you see several gigabytes listed, you can clear old logs with sudo journalctl --vacuum-size=100M. Most people never look here because it's not a "process" that shows up visibly in htop — it hides in the kernel log buffer.

What Not to Do

Avoid These

1. Don't panic when "free" is near zero. Linux uses free RAM as cache. That's not a problem, it's a feature.

2. Don't disable swap entirely on a low-RAM system. Without swap, the OOM killer will start terminating processes when RAM fills up — often randomly.

3. Don't run drop_caches in production regularly. Dropping the page cache forces the disk to re-read everything, causing a temporary performance hit.

4. Don't kill processes you don't recognize without checking. Some system daemons look unfamiliar but are critical. Google the process name first.

How to Diagnose RAM Usage — Step by Step

Run: free -h
Check "available" column. Is it above 1GB? If YES → RAM is fine, check CPU instead
If NO → run htop, sort by memory (press M)
Is one process dominating? If YES → kill or restart it
If NO (spread across many) → check swap: swapon --show
Swap heavily used? → add more swap or close background services
Still slow after all this? → physical RAM upgrade may be needed

If You Only Do One Thing

Run free -h right now and look at the "available" column — not "free." If available is above 1–2GB and swap is at zero, your RAM situation is fine regardless of what "used" says. Most people troubleshoot a RAM problem that doesn't exist because they're reading the wrong column. Check the right number first.

People Also Ask

The quickest command is free -h, which shows total, used, and available RAM in human-readable format. For live monitoring by process, use htop.

A minimal Ubuntu server uses 150–300MB. A full GNOME desktop typically uses 1.5–2.5GB at idle. Both are normal for their respective configurations.

Run ps aux --sort=-%mem | head -10 for a ranked list, or open htop and press M to sort by memory interactively.

Linux uses spare RAM as disk cache — this is normal and intentional. Look at the "available" column in free -h rather than "used." If available is healthy, your system is fine.

Related Articles