Skip to main content
To check memory usage on Linux, run free -h. Read the available column: it is the kernel’s estimate of how much RAM new programs can use without swapping. buff/cache is disk cache that Linux frees when programs need it, so low free is normal. To see which processes use the most RAM, run ps -eo pid,user,rss,%mem,comm --sort=-rss | head.

Before you start

  • Connect with SSH. The commands here don’t need sudo.
  • free reads /proc/meminfo, so it shows what the operating system sees. On a VPS that is the RAM in your plan, minus a little the kernel reserves.

How to check memory usage with free

-h prints human-readable units. Use -m for mebibytes or -g for gibibytes.

What the free columns mean

A server with little free memory and a large buff/cache is healthy. Linux uses spare RAM as cache and gives it back when a program needs it. You only have a memory problem when available is low.

How to watch memory over time

In vmstat, watch si and so (memory swapped in and out per second). Values above 0 on every line mean the server is short of RAM and using swap, which is much slower than memory.

How to find which process uses the most memory

RSS (resident set size) is the physical RAM a process uses, in KiB. Several processes of the same program (PHP-FPM workers, Apache) share some memory, so adding their RSS values overstates the total. For an interactive view, open htop and press M to sort by memory. See monitor resources with htop. To see memory per service rather than per process:
The Memory: line shows what the whole service (all its processes) uses. Replace mariadb with your service name.

How to check swap usage

No output means the server has no swap. Swap gives the kernel room to move rarely used memory to disk instead of killing a process, but heavy swap use slows everything down. To add some, see add swap space.

How to tell if the server ran out of memory

When RAM and swap are both exhausted, the kernel’s out-of-memory (OOM) killer ends a process. Check the kernel log:
A line such as Out of memory: Killed process 2038 (mariadbd) names the victim. Fixes are in fix out of memory killed processes.

What to do if memory is low

1

Find the biggest user

Run the ps command above or htop, sorted by memory.
2

Restart or tune it

A leak often clears after sudo systemctl restart name. For databases, PHP-FPM and Java game servers, lower their memory settings (buffer pool, pm.max_children, -Xmx).
3

Cap it

Stop one program taking all the RAM with a MemoryMax= limit. See limit CPU and memory for a process.
4

Add swap or RAM

Add a swap file as a safety net, or move to a plan with more memory.
You may find advice to run echo 3 > /proc/sys/vm/drop_caches to “free memory”. It only empties the cache, which the kernel would free anyway when needed, and it makes the server slower until the cache refills. Don’t add it to cron.

Frequently asked questions

Why is my free memory so low when nothing is running?

Linux fills spare RAM with file cache. Check available, not free. If available is high, you have plenty of memory.

What is the difference between free and available memory?

free is RAM holding nothing at all. available adds the cache and other memory the kernel can reclaim, so it shows the real room for new programs.

Why does my VPS show slightly less RAM than my plan?

The kernel reserves some memory for itself at boot, so total is a little lower than the installed RAM. That is normal on every Linux server.

How do I see memory usage in MB?

Run free -m. For gigabytes use free -g (rounded down) or free -h.

VPS and dedicated server guides

Every server guide in one place.

Fix out of memory errors

When the OOM killer strikes.

Add swap space

Create a swap file safely.

Monitor resources with htop

Live view of every process.

Limit CPU and memory

systemd MemoryMax and CPUQuota.

VPS Panel resource graphs

Memory use over time.

Checked against the free(1), ps(1) and vmstat(8) manuals and the Linux kernel /proc/sys/vm documentation on 4 November 2026; commands tested on Ubuntu 24.04 LTS. Commands can differ on other distributions or releases.

Need Extra Help?

If you encounter any issues, our support team is ready to assist:

Save on Your Hosting

Ready to upgrade your hosting? Use code KB20 at checkout for 20% off your first order!

Last Updated: November 2026