12 Essential Linux Commands to Monitor Memory Usage
This guide lists twelve Linux tools and commands—including /proc/meminfo, atop, free, GNOME System Monitor, htop, KDE System Monitor, memstat, nmon, ps, smem, top, and vmstat—detailing how each provides real‑time or summarized insights into RAM consumption and overall system performance.
When optimizing a Linux system, monitoring physical memory is crucial, and Linux offers many utilities to observe memory usage. The following list describes twelve methods, ranging from simple file reads to graphical monitors, each with example commands.
/proc/meminfo
The virtual file /proc/meminfo provides a dynamic snapshot of memory statistics, serving as the data source for tools like free, ps, and top. Process‑specific memory can also be examined via /proc/<pid>/statm and /proc/<pid>/status.
cat /proc/meminfo
atop
The atop command runs in a terminal and displays a colored, comprehensive view of CPU, memory, network, I/O, and kernel activity, especially useful under high load.
sudo atop
free
freeoffers a quick overview of memory usage by summarizing the information gathered from /proc/meminfo.
free -h
GNOME System Monitor
A graphical tool that shows recent CPU, memory, swap, and network usage, allowing users to inspect processes and resource consumption.
gnome-system-monitor
htop
htopprovides a real‑time, interactive view of each process's memory usage, including resident set size, shared libraries, and total memory per process, with scrollable lists.
htop
KDE System Monitor
Provides functionality similar to the GNOME monitor, invoked with ksysguard.
ksysguard
memstat
memstatidentifies virtual memory usage of executables, processes, and shared libraries. With a PID, it lists associated files, data, and libraries.
memstat -p
nmon
An ncurses‑based benchmark tool that monitors CPU, memory, I/O, filesystem, and network. For memory, it shows total and free memory and swap usage in real time.
nmon
ps
The ps command can display each process's memory usage, including %MEM, VSZ, and RSS. Sorting by RSS is possible with the --sort -rss option.
ps aux --sort -rss
smem
smemaggregates memory usage per process and per user based on /proc data, and can export charts such as bar or pie graphs.
sudo smem --pie name -c "pss"
top
topprovides a live view of running programs and their resource consumption, allowing sorting by memory usage.
top
vmstat
vmstatreports both real‑time and averaged statistics for CPU, memory, and I/O. It shows physical and virtual memory usage.
vmstat
This collection equips Linux administrators with a comprehensive toolbox for tracking memory consumption, from low‑level file reads to full‑featured graphical monitors.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
ITPUB
Official ITPUB account sharing technical insights, community news, and exciting events.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
