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—that let you view and analyze RAM consumption in real time, with usage examples and screenshots.
When optimizing a Linux system, physical memory is a critical resource, and Linux provides many ways to monitor its usage. The following list details various tools and command‑line methods for checking memory consumption on Linux.
/proc/meminfo
The simplest way to view RAM usage is the virtual file /proc/meminfo, which aggregates data shown by tools such as free, ps, and top. It lists all memory statistics, and per‑process memory can also be examined via /proc/<pid>/statm and /proc/<pid>/status.
cat /proc/meminfoatop
The atop command is a terminal‑based monitor that shows CPU, memory, network, I/O, and kernel activity, with color‑coded highlights for high‑load situations.
sudo atopfree
The free command provides a quick overview of memory usage by summarizing information gathered from /proc/meminfo.
free -hGNOME System Monitor
GNOME System Monitor is a graphical tool that displays recent CPU, memory, swap, and network usage, offering another way to view memory consumption.
gnome-system-monitorhtop
htopshows real‑time memory usage for each process, reporting resident set size, total program memory, shared library size, and allows horizontal and vertical scrolling.
htopKDE System Monitor
The KDE counterpart provides the same functionality as the GNOME version.
ksysguardmemstat
memstatidentifies the virtual memory usage of executables, processes, and shared libraries. Given a PID, it lists the associated executable files, data, and libraries.
memstat -p <PID>nmon
nmonis an ncurses‑based benchmark tool that monitors CPU, memory, I/O, filesystem, and network resources. For memory, it shows total/available memory and swap in real time.
nmonps
The ps command displays memory usage per process, including %MEM, VSZ, and RSS. It supports sorting, e.g., by RSS.
ps aux --sort -rsssmem
smemaggregates memory usage per process and user based on /proc data, and can export charts such as bar or pie graphs.
sudo smem --piename -c "pss"top
topprovides a real‑time view of running processes and their resource consumption, allowing sorting by memory usage.
topvmstat
vmstatshows both real‑time and average statistics for CPU, memory, I/O, etc. For memory, it reports physical and virtual memory details.
vmstat -sSigned-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.
Open Source Linux
Focused on sharing Linux/Unix content, covering fundamentals, system development, network programming, automation/operations, cloud computing, and related professional knowledge.
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.
