How to view memory usage in Linux and how to view memory usage in linux
In Linux, view CPU and memory usage:
During Linux system optimization, physical memory is the most important aspect. Naturally, Linux also provides many methods to monitor the usage of valuable memory resources. The following list details how to view memory usage using a View tool or command line in Linux.
1./proc/meminfo
The simplest way to view RAM usage is through/proc/meminfo. This dynamically updated Virtual File is actually a combination of many other memory-related tools (such as free/ps/top. /Proc/meminfo lists all the memory usage information you want to know. You can also view the memory usage information of a process through/proc // statm and/proc // status.
$ Cat/proc/meminfo
2. atop
The atop command is a monitoring command for the terminal environment. It displays the synthesis of various system resources (CPU, memory, network, I/O, and kernel) and is marked in color at high loads.
$ Sudo atop
3. free
The free command is a quick way to view memory usage. It is an overview of the information collected by/proc/meminfo.
$ Free-h
4. GNOME System Monitor
GNOME System Monitor is a View tool that displays CPU, memory, swap zone, and network usage in the recent period. It also provides a way to view CPU and memory usage.
$ Gnome-system-monitor
5. htop
The htop command displays the real-time memory usage of each process. It provides reports on the resident memory size, total program memory size, and shared library size of all processes. The list can be horizontally or vertically rolled.
$ Htop
6. KDE System Monitor
The feature is the same as the GENOME version described in section 4.
$ Ksysguard
7. memstat
Memstat is a command that effectively recognizes executable (s), process (es), and shared libraries virtual memory usage. Given a process ID, memstat can list executable files, data, and shared libraries related to the process.
$ Memstat-p
8. nmon
Nmon is a ncurses-based system benchmark testing tool that monitors interaction modes such as CPU, memory, I/O, file systems, and network resources. For memory usage, it can display the total/remaining memory, swap space and other information in real time.
$ Nmon
9. ps
The ps command can display the memory usage of each process in real time. Reported memory usage information provided des % MEM (percent of physical memory used), VSZ (total amount of virtual memory used), and RSS (total amount of physical memory used ). You can use the "-sort" option to sort processes, for example, by RSS:
$ Ps aux-sort-rss
10. smem
The smem command allows you to count the memory usage of different processes and users based on/proc information. Memory usage analysis can export charts (such as bar charts and pie charts ).
$ Sudo smem-pie name-c "pss"
11. top
The top command provides statistics on the resource usage of running programs in real time. You can sort by memory usage and size.
$ Top
12. vmstat
The vmstat command displays real-time and average statistics, covering CPU, memory, I/O, and so on. For example, the memory not only displays physical memory, but also counts virtual memory.
$ Vmstat-s