Home >Operation and Maintenance >Linux Operation and Maintenance >How to check memory usage in linux

How to check memory usage in linux

王林
王林Original
2021-02-03 15:27:4166600browse

How to check memory usage in Linux: You can check it by executing the [cat /proc/meminfo] command. If we want to view the memory usage information of the process, we can execute the [/proc/status] command.

How to check memory usage in linux

The operating environment of this article: red hat enterprise linux 6.1 system, thinkpad t480 computer.

The specific commands are as follows:

1./proc/meminfo

The easiest way to check RAM usage is through /proc/meminfo. This dynamically updated virtual file is actually a combination display of many other memory-related tools (such as: free / ps / top), etc. /proc/meminfo lists all the memory usage you want to know about. The memory usage information of the process can also be viewed through /proc//statm and /proc//status.

$ cat /proc/meminfo 
MemTotal:        8010436 kB
MemFree:         7514008 kB
MemAvailable:    7567204 kB
Buffers:             872 kB
Cached:           282844 kB
SwapCached:            0 kB
Active:           213156 kB
Inactive:         111632 kB
Active(anon):      41264 kB
Inactive(anon):    32888 kB
Active(file):     171892 kB
Inactive(file):    78744 kB
Unevictable:           0 kB
Mlocked:               0 kB
SwapTotal:             0 kB
SwapFree:              0 kB
Dirty:                32 kB
Writeback:             0 kB
AnonPages:         41088 kB

2. atop

atop command is a terminal environment monitoring command. It shows a combination of various system resources (CPU, memory, network, I/O, kernel) and is color-coded under high load conditions.

$ sudo atop

How to check memory usage in linux

3. The free

free command is a quick way to check memory usage. It is a summary of the information collected by /proc/meminfo Overview.

$ free -h

4. GNOME System Monitor

GNOME System Monitor is a view tool that displays the usage of CPU, memory, swap area and network 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 of all processes, total program memory size, shared library size, etc. The list can be scrolled horizontally and vertically.

$ htop

Related recommendations: linux tutorial

The above is the detailed content of How to check memory usage in linux. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn