Linux

How to Check RAM Usage in Linux: 5 Simple Ways

In this guide, you'll learn how to use built-in Linux tools to check the amount of used and free RAM, as well as identify processes consuming the most RAM.

Updated at February 16, 2026
5-10 min
Easy
FixPedia Team
Применимо к:Ubuntu 20.04+Debian 11+CentOS 8+Fedora 35+Arch Linux

Introduction / Why This Matters

Understanding how your Linux system uses RAM (random-access memory) is a critically important skill for diagnosing slowdowns, planning hardware upgrades, or optimizing a server. Unlike Windows, Linux actively uses free RAM for disk caching, which can be misleading. This guide will show you how to correctly interpret memory data using standard utilities to distinguish normal operation from actual RAM shortage.

After completing this, you'll confidently read the output of free, top, and htop, understand what "free" memory means and where cache fits in, and quickly identify memory-hungry processes.

Requirements / Preparation

  • Access to a terminal (Ctrl+Alt+T or an SSH connection).
  • Basic familiarity with the command line.
  • Permissions to run utilities (all commands are available to a regular user, except package installation, which requires sudo).
  • To use htop, installation may be required (instructions are in step 3).

Step-by-Step Instructions

Step 1: Use the free Command for a General Summary

The free command is the fastest way to get an overview of RAM and swap usage.

free -h

Example output:

              total        used        free      shared  buff/cache   available
Mem:           7.7G        1.2G        4.1G        156M        2.4G        6.0G
Swap:          2.0G          0B        2.0G

How to read it:

  • total — the total amount of installed RAM.
  • used — memory occupied by processes (but not all of it, because in Linux used = total - free - buff/cache).
  • free — completely unused RAM (this number is usually small in Linux, and that's normal).
  • buff/cache — memory used by the kernel for disk cache and buffers. It can be automatically freed for applications.
  • availablethe most important metric. An estimate of memory available for starting new applications without using swap. Use this as your primary guide.

💡 Tip: If available approaches zero and the system actively uses swap, that's a sign of insufficient physical RAM.

Step 2: Monitor Processes in Real Time with top

top shows a dynamic list of processes, sorted by CPU usage by default. However, you can configure it to analyze memory.

top

Inside top:

  1. Press F6 (or > to sort by the next field).
  2. Select the field %MEM (percentage of total RAM) or RES (physical memory in KiB) and press Enter.
  3. Now processes are sorted by memory consumption. The most "gluttonous" will be at the top.
  4. To exit, press q.

Key columns in top:

  • VIRT — virtual memory (includes code, data, shared libraries, mapped files, and swap).
  • RES — resident memory (physical RAM occupied by the process, excluding swap).
  • %MEM — percentage of RES relative to total RAM.

Step 3: Install and Use htop for a User-Friendly Interface

htop is an improved, interactive, and colorized alternative to top. It's more visually intuitive.

# Installation (if not present)
# For Debian/Ubuntu:
sudo apt update && sudo apt install htop

# For CentOS/RHEL/Fedora:
sudo dnf install htop   # or sudo yum install htop

# Launch
htop

In htop:

  • At the top of the screen — colored bars with labels: Mem (RAM) and Swp (Swap). The green part is used, blue is buffers/cache.
  • Default sorting is by CPU. Press F6, select %MEM or RES to sort by memory.
  • F5 — toggle between tree view (shows child processes) and list view.
  • F10 — exit.

htop also displays convenient real-time graphs for CPU and RAM usage.

Step 4: Use vmstat for Statistics

vmstat (virtual memory statistics) provides a summary of memory, processes, swap, and I/O.

vmstat -s

Example output:

  8192000  total memory
  4194304  used memory
  1064960  active memory
  2109440  inactive memory
  3997696  free memory
   524288  buffer memory
  2109440  swap cache
        0  total swap
        0  used swap
        0  free swap
   123456  non-nice user cpu ticks
     ...

This format compactly shows absolute values (in kilobytes). Useful for quick assessment in scripts.

Step 5: Check Detailed Information in /proc/meminfo

For the most detailed information (which the utilities above use), check the kernel's virtual file:

cat /proc/meminfo

Key fields:

  • MemTotal — total RAM.
  • MemFree — completely free RAM.
  • MemAvailable — estimate of available RAM (similar to free).
  • Buffers — memory for block device buffers.
  • Cached — memory for page cache (file cache).
  • SwapTotal / SwapFree — swap.

This file is the source of truth for all the commands listed above.


Verification

You have successfully checked RAM usage if:

  1. The free -h command displayed a table with understandable values, and you can explain the difference between free and available.
  2. In htop or top, you sorted processes by %MEM or RES and saw a list with memory consumption.
  3. You understand that a high buff/cache value is good, while a low available value is bad.

Success criterion: You can answer the question "How much memory is actually available for new applications?" by looking at the available field in free or the indicator in htop.


Potential Issues

  • htop: command not found — the utility is not installed. Install it via your distribution's package manager (see Step 3).
  • free shows a very low available value, but the system is running fast — you might have just launched a heavy application, and the cache hasn't had time to free up yet. Wait a few seconds and check again. If available is consistently low and swap is active — consider upgrading your RAM.
  • No permissions to install packages — installing htop requires sudo privileges. Contact your administrator or use only free, top, vmstat, which are almost always available.
  • /proc/meminfo is unavailable — this can only happen in very stripped-down container or embedded environments. In a normal system, this file always exists. In a container, use free or cat /sys/fs/cgroup/memory.current (depends on the cgroup version).

F.A.Q.

What's the difference between the free and top commands for checking memory?
What do the 'buff/cache' and 'available' fields mean in the free output?
How to install htop if it's not in the system?
Why can 'used' in free be high but the system doesn't slow down?

Hints

Use the free command for a summary
Monitor processes in real-time with top
Install and use htop for a user-friendly interface
Use vmstat for statistics
Check detailed information in /proc/meminfo
FixPedia

Free encyclopedia for fixing errors. Step-by-step guides for Windows, Linux, macOS and more.

© 2026 FixPedia. All materials are available for free.

Made with for the community