October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
VGSources
Blog

How to Check Memory Usage on a Linux VPS (and Find RAM Pressure)

A practical Linux VPS memory guide: read available RAM correctly, find the process using resident memory, monitor swap activity, and diagnose pressure without mistaking filesystem cache for a failure.
Length9 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

SSH into the VPS and run free -h. Read the available value as your practical headroom, then check the Swap row. Use top and press Shift+M to find the biggest memory users, or run ps aux --sort=-%mem | head for a one-time list. If the snapshot is unclear, inspect /proc/meminfo and watch activity with vmstat 1.

What you are trying to measure

A Linux VPS exposes several different views of memory. Total RAM is the physical memory assigned to the virtual machine. A process list shows which programs have resident pages. The kernel also uses otherwise idle RAM for filesystem cache, and swap provides storage-backed overflow when RAM is under pressure. Those figures answer different questions, so no single column is a complete diagnosis.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For a game server or other always-on service, the useful questions are:

  • How much memory can a new process use without forcing swapping?
  • Which service is occupying resident physical RAM?
  • Is swap merely configured, or is the kernel actively moving pages to and from it?
  • Is memory usage stable, or is a process steadily growing toward an out-of-memory event?

Take more than one sample when investigating a problem. A single reading can reflect a cache warm-up, a scheduled backup, a game-server map load, or another short-lived event.

Start with free -h

Run the summary command

  1. Connect to the VPS over SSH.
  2. Run free -h.
  3. Read the Mem: row, especially total, used, free, shared, buff/cache, and available.
  4. Read the Swap: row for total, used, and free swap.

The free(1) manual describes the command as displaying total, free, and used physical and swap memory, together with kernel buffers. Its values are parsed from /proc/meminfo.

Interpret the important columns

Column Meaning How to use it
total Memory visible to the system for that row. Use it as the capacity baseline, not as a statement of how much is immediately free.
used For the Mem: row, free calculates it as total minus available. A high value alone is not proof of a problem because reclaimable cache is included in the accounting.
free Unused memory. A small value is normal when Linux is using spare RAM for cache.
available An estimate of physical memory that can be given to applications without swapping. This is the best first indicator of practical headroom for starting a process.
buff/cache Kernel buffers and cache; the top(1) manual defines physical cache here as Buffers + Cached + SReclaimable. Much of it can be reclaimed when applications need RAM.
Swap used Configured swap capacity minus free swap. It tells you that pages are parked in swap, not whether swapping is happening right now.

Do not calculate a “safe” universal percentage from these fields. A VPS with a low free value can be healthy if available remains comfortable and swap activity is quiet. Conversely, a machine can be in trouble before every megabyte is consumed if available memory is falling and the kernel is repeatedly swapping.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Find the process using the most memory

Use top for a live view

  1. Run top.
  2. Press Shift+M (capital M) to sort the process table by memory.
  3. Watch the leading processes for several refreshes instead of judging one instant.
  4. Press q to quit.

top is useful when a game server, database, web service, or backup job is changing its footprint while you watch. Its summary also shows physical memory and swap information, while the process table lets you connect that pressure to a PID and command.

Use ps for a one-shot report

For a quick sorted list, run:

ps aux --sort=-%mem | head

This sorts by each process’s percentage of physical memory and prints the first entries. When the question is specifically “which processes have resident physical pages?”, sort by RSS instead of relying on virtual size:

ps aux --sort=-rss | head

The ps aux columns include %MEM, virtual memory size (VSZ), and resident set size (RSS). RSS is the non-swapped physical memory currently resident for that process. VSZ is the process’s virtual address-space size and can include mapped regions that are not resident, so VSZ is not a substitute for physical-RAM usage.

Understand RSS, VSZ, and shared memory

RSS is the most direct process-level clue when you are trying to explain pressure on the VPS, but it is not a perfect ownership ledger. Processes can share libraries and pages, and kernel accounting has details that do not appear as a simple one-process-one-byte allocation. Use RSS to rank candidates, then inspect the service and its own limits before deciding that one process is solely responsible.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

%MEM is a percentage of the machine’s physical memory. A process can have a large VSZ while using considerably less resident RAM. A growing RSS over repeated samples is more concerning than a large but stable virtual address space.

Inspect the kernel counters with /proc/meminfo

Run the detailed view

Use:

cat /proc/meminfo

The file reports one named counter per line, followed by a value and unit. The most useful fields for a first investigation are:

  • MemTotal: total physical memory reported to the kernel.
  • MemFree: currently unused memory.
  • MemAvailable: the kernel’s estimate of memory available to applications without swapping.
  • Buffers and Cached: major parts of filesystem-related memory accounting.
  • SwapTotal and SwapFree: configured swap capacity and its unused portion.

These counters are not independent buckets. Kernel documentation warns that proc memory counters can overlap, so adding every line together will not produce a valid usage total. Use free for the summary and consult individual fields only for the question they describe.

Measure change over time with vmstat

Run:

vmstat 1

This prints a new sample every second. Keep it running while reproducing the load, then stop it with Ctrl+C. The memory columns help you see whether the system is merely caching files or is actively moving pages through swap. In particular, inspect the swap-in and swap-out activity columns (commonly shown as si and so on Linux): sustained non-zero activity while applications are busy is stronger evidence of pressure than swap being configured or containing old pages.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

If you only need periodic summaries, repeat free -h at intervals and record the values. A trend of declining available memory, rising process RSS, or increasing swap activity is more informative than a single snapshot.

How to tell whether the VPS is actually under memory pressure

Signs that are usually benign

  • free is small, but available remains stable.
  • buff/cache is substantial and falls when an application needs memory.
  • Swap is configured or has some used space, but vmstat shows no sustained swapping activity.
  • Top processes have stable RSS and the VPS responds normally.

Linux intentionally uses spare RAM for filesystem cache. Reclaiming that cache is preferable to leaving RAM idle, so “almost all RAM used” is not, by itself, an incident.

Signs that deserve action

  • available keeps falling across samples.
  • vmstat 1 shows sustained swap-in or swap-out activity during normal workload.
  • A process’s RSS grows steadily rather than returning to a baseline after a task completes.
  • Services become sluggish, time out, restart, or log out-of-memory-killer events.

There is no evidence-based universal percentage at which every VPS becomes unsafe. Workload, kernel version, swap configuration, and service limits all matter. Base the decision on these symptoms and on the trend.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A repeatable investigation procedure

  1. Capture a baseline. Run free -h and note available, swap used, and the time.
  2. Rank processes. Use top with Shift+M, then confirm with ps aux --sort=-rss | head if resident memory is the question.
  3. Check direction. Run vmstat 1 during the suspected workload, or take repeated free -h samples.
  4. Inspect details. Use cat /proc/meminfo when the summary and process list do not account for the change.
  5. Correlate with service events. Compare the time of memory growth with game-server restarts, map changes, backups, deployments, or scheduled jobs.
  6. Verify limits. If totals do not match what the VPS plan promises, inspect container or service limits as well as host-level memory.
  7. Record the result. Save the command output and timestamp so the next sample can show whether the condition is improving or worsening.

When free and ps do not add up

It is normal for a process list not to explain every byte shown by the system summary. Kernel memory, filesystem cache, shared pages, and other subsystem allocations are not all assigned to one user-space PID. The overlapping nature of /proc/meminfo counters makes naive addition misleading as well.

When the gap is material or persistent, examine the detailed proc counters and the kernel or subsystem-specific interfaces relevant to the VPS. Also check whether the VPS is running inside a container or a service manager with a memory limit: the host’s total RAM and the process’s allowed cgroup can be different ceilings. A process can be killed by its limit even when the host-wide available value looks acceptable.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Common mistakes and their fixes

“The free column is low, so the VPS is out of RAM.”

Check available, buff/cache, and swap activity first. Cache can be reclaimed, while available memory estimates what applications can obtain without swapping.

“Swap used means the server is swapping right now.”

Swap used is a capacity calculation: SwapTotal minus SwapFree. Use vmstat 1 to see current swap-in and swap-out activity.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

“The process with the largest VSZ owns all that memory.”

VSZ measures virtual address space. Sort by RSS when resident physical memory is the question, and remember that shared pages complicate exact attribution.

“One top screen proves there is a leak.”

Take repeated samples. A leak is suggested by steadily growing RSS that does not fall after the workload ends, not by one large reading.

“Adding every /proc/meminfo line gives the total.”

Do not do this. The kernel documents overlapping counters; use the named fields for their intended meanings.

Best Value
Sale
UNIX and Linux System Administration Handbook, 4th Edition
  • New
  • Mint Condition
  • Dispatch same day for order received before 12 noon
  • Guaranteed packaging
  • No quibbles returns

Choosing the right command

Need Best first tool Why
One human-readable system summary free -h Shows physical memory, practical available headroom, and swap in one screen.
Interactive process attribution top Live view; Shift+M sorts by memory.
One-shot sorted process list ps aux --sort=-%mem | head Convenient report with percentage, VSZ, and RSS.
Resident-memory ranking ps aux --sort=-rss | head Sorts by resident physical memory rather than virtual size.
Kernel-level detail cat /proc/meminfo Exposes named counters behind the summary.
Short-term trend and swapping vmstat 1 Produces repeated samples so activity is visible over time.

What to do after you identify pressure

First preserve evidence: capture free -h, the sorted process list, and a short vmstat 1 sample. Then determine whether the cause is a single growing service, a legitimate workload spike, kernel or cache usage, or a restrictive container limit. Restarting a process may temporarily reduce RSS, but it does not explain why it grew; use the trend and service logs to distinguish a leak from expected loading.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

If swapping is sustained, reduce concurrent workload or move the service to a VPS with more physical memory after confirming that the workload, rather than an accounting misunderstanding, is the cause. If an OOM-killer event occurred, identify the killed PID and the applicable host or service limit before changing configuration. Keep monitoring after the change to verify that available memory and swap activity recover.

Practical checklist

  • SSH to the VPS.
  • Run free -h; read available, not just free.
  • Read the Swap row and distinguish configured usage from active swapping.
  • Run top and press Shift+M.
  • Confirm resident memory with ps aux --sort=-rss | head.
  • Use cat /proc/meminfo for named kernel counters.
  • Use vmstat 1 or repeated summaries to establish a trend.
  • Check kernel, subsystem, container, and service limits when totals do not reconcile.
  • Investigate falling available memory, sustained swapping, growing RSS, and OOM-killer events rather than reacting to a low free value alone.

Frequently Asked Questions

Why does Linux report almost all RAM as used?

Linux uses spare RAM for filesystem cache. A low free value is not automatically a failure; stable available memory and quiet swap activity are better signs that the VPS is healthy.

How can I see whether swapping is happening now?

Run vmstat 1 and watch the swap-in and swap-out columns, commonly labeled si and so. Swap capacity shown as used does not prove current swapping.

Should I sort processes by VSZ or RSS?

Use RSS when you want resident physical memory. VSZ is virtual address-space size and can include mapped regions that are not resident.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.