How to check the memory usage of Linux
Problem: I want to monitor the memory usage of Linux. Which graphic interfaces or command line tools are available to check the current memory usage?
When it comes to Linux system performance optimization, physical memory is the most important factor. Naturally, Linux provides a variety of options to monitor the usage of precious memory resources. Different tools, in the monitoring granularity (for example, full system scope, each process, each user), interface methods (such as: graphical user interface, command line, ncurses) or the running mode (Interactive Mode and batch processing mode) is different.
The following is a list of optional but not comprehensive graphics or command line tools used to check the memory used and available on the Linux platform.
1./proc/meminfo
One of the simplest ways is to use "/proc/meminfo" to check memory usage. This dynamically updated Virtual File is actually a source of information for memory-related tools such as free, top, and ps. From the number of available/idle physical memory to the number of waiting to be written to the cache or the number of written back disks, "/proc/meminfo" is everything you want about memory usage. The memory information of a specific process can also be obtained through "/proc/<pid>/statm" and "/proc/<pid>/status.
- $ Cat/proc/meminfo
2. atop
The atop command is an ncurses-based interactive system and process monitoring tool for the terminal environment. It displays the summary of dynamically updated system resources (CPU, memory, network, input/output, kernel), and marks the High-load part of the system in a highlighted color with warning information. It also provides a resource usage view similar to top threads (or users), so the system administrator can find the process or user-caused system load. The memory statistics report includes the total/idle memory, cached/buffered memory, and submitted virtual memory.
- $ Sudo atop
3. free
The free command is a quick and easy way to get the memory usage overview, which is obtained from "/proc/meminfo. It provides a snapshot to display the total/idle physical memory and system swap areas, as well as the used/idle kernel buffer.
- $ Free-h
4. GNOME System Monitor
GNOME System Monitor is a graphical application that displays recent historical information about System resource usage, including CPU, memory, swap zone, and network. It also provides a process view with CPU and memory usage.
- $ Gnome-system-monitor
5. htop
The htop command is an interactive process view based on ncurses. It displays the memory usage of each process in real time. It can report the resident memory size (RSS) of all running processes, the total size of programs in the memory, the library size, the shared page size, and the dirty page size. You can scroll through the process list either horizontally or vertically.
Why does Linux's htop command win the top command?
Use the most powerful process monitor htop in Ubuntu
Install htop process management and monitoring tools in CentOS 6.5
- $ Htop
6. KDE System Monitor
Like GNOME desktop with GNOME System Monitor, KDE Desktop also has its own counterpart application: KDE System Monitor. The features of this tool are very similar to those of GNOME, that is, it also shows a real-time history of system resource usage and CPU/memory consumption of each process.
- $ Ksysguard
For more details, please continue to read the highlights on the next page: