How to check the memory in Linux: 1. Check the memory through the "/proc/meminfo" method; 2. Use the free command to check the memory; 3. Use the ps command to display the memory usage of each process; 4. Use top The command displays the real-time memory usage of each process.
Recommendation: "linux course"
1) The easiest way to check 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 you want to know about.
$ cat /proc/meminfo
2) The free command is a quick way to view memory usage. It is an overview of the information collected by /proc/meminfo.
#3) The ps command can display the memory usage of each process, as well as more detailed physical memory usage and virtual memory usage. You can use the "-sort" option to sort processes, such as sorting by RSS:
$ ps aux --sort -rss
4) The top command displays the real-time memory usage of each process. It provides reports on the resident memory size of all processes, total program memory size, shared library size, etc.
The above is the detailed content of How to check memory in linux?. For more information, please follow other related articles on the PHP Chinese website!