Operations 12 min read

How to Quickly Check Linux Memory Usage with Free, /proc/meminfo, vmstat, top, htop and More

This guide explains how to monitor memory usage on a Linux 7.9 system using a variety of commands and tools—including free, /proc/meminfo, vmstat, top, htop, sar, smem, glances and ps_mem—showing key metrics, options, example outputs and interpretation tips for both servers and desktops.

Liangxu Linux
Liangxu Linux
Liangxu Linux
How to Quickly Check Linux Memory Usage with Free, /proc/meminfo, vmstat, top, htop and More

The tutorial runs on a Linux 7.9 system (Dell G3) and demonstrates several commands that let you quickly inspect memory usage, helping prevent resource shortages that can degrade web services or desktop performance.

1. Using free

The free command displays physical memory, swap, shared memory and cache. Common options: -m – show values in megabytes. -h – show human‑readable units.

Example: free -m Key fields in the output: total – total RAM (e.g., 7822 MB ≈ 7.6 GB). used – amount of RAM in use (e.g., 322 MB). free – idle RAM. shared – shared memory. buff/cache – memory used for buffers and cache, reclaimable when needed. available – memory readily available for new processes.

2. Viewing /proc/meminfo

Reading the virtual file /proc/meminfo provides detailed statistics. Example command: $ cat /proc/meminfo Important entries include: MemTotal – total physical memory. MemFree – free memory. MemAvailable – memory available for allocation. Buffers and Cached – buffer and cache usage. SwapTotal and SwapFree – swap space statistics.

3. Using vmstat

vmstat

(Virtual Memory Statistics) reports CPU, process, memory, swap and I/O information. The -s option provides a summary similar to /proc/meminfo: vmstat -s Typical output shows total memory, used memory and free memory at the top of the report.

4. Using top

The top command shows per‑process CPU and memory usage and also a summary of overall memory: top Key lines: KiB Mem – total, used, free and buffer memory. KiB Swap – total, used and free swap.

Sorting options (e.g., top -o %MEM or top -o %CPU) help identify the most memory‑ or CPU‑intensive processes.

5. Using htop

htop

is an interactive, color‑enhanced alternative to top. It supports vertical and horizontal scrolling, process killing, and displays additional metrics. Install with:

yum install htop -y

6. Using sar

The sar tool (System Activity Reporter) can monitor memory with sar -r. Example: sar -r 2 3 Important fields: kbmemfree – free physical memory. kbmemused – used physical memory. %memused – percentage of memory used. kbbuffers and kbcached – buffer and cache usage. kbcommit and %commit – memory committed by applications.

7. Using smem

smem

reports Proportional Set Size (PSS), Unique Set Size (USS) and Resident Set Size (RSS) for processes, giving a more accurate view of shared memory usage. Install with: yum install smem Typical command:

smem -tk

8. Using glances

glances

is a Python‑based cross‑platform monitoring tool that displays CPU, memory, processes, network, disks, Docker, sensors and more in a single screen. Run it simply with:

glances

9. Using ps_mem

ps_mem

is a Python script that aggregates memory usage per program rather than per process, calculating total RAM used by each application. Install with: yum install ps_mem Run with: ps_mem These tools together provide a comprehensive view of memory consumption, helping administrators and developers diagnose performance bottlenecks and ensure sufficient resources for services.

图片
图片
图片
图片
图片
图片
图片
图片
1.png
1.png
2.png
2.png
3.png
3.png
4.png
4.png
5.png
5.png
6 (1).gif
6 (1).gif
7.gif
7.gif
8.png
8.png
9.gif
9.gif
10.gif
10.gif
LinuxtopFreehtopGlancessarvmstatsmemps_mem
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.