Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the ways to view memory in Linux system

2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you what are the ways to check memory in the Linux system. I hope you will get something after reading this article. Let's discuss it together.

1./proc/meminfo

The easiest way to see 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. Memory usage information for processes can also be viewed through / proc//statm and / proc//status.

$cat / proc/meminfoMemTotal: 8010436 kBMemFree: 7514008 kBMemAvailable: 7567204 kBBuffers: 872 kBCached: 282844 kBSwapCached: 0 kBActive: 213156 kBInactive: 111632 kBActive (anon): 41264 kBInactive (anon): 32888 kBActive (file): 171892 kBInactive (file): 78744 kBUnevictable: 0 kBMlocked: 0 kBSwapTotal: 0 kBSwapFree: 0 kBDirty: 32 kBWriteback: 0 kBAnonPages: 41088 kBMapped: 35936 kBShmem: 33080 kBSlab: 66888 kBSReclaimable: 48120 kBSUnreclaim: 18768 kBKernelStack: 1872 kBPageTables: 2788 kBNFS_Unstable: 0 kBBounce: 0 kBWritebackTmp: 0 kBCommitLimit: 4005216 kBCommitted_AS: 272452 kBVmallocTotal: 34359738367 kBVmallocUsed: 22136 kBVmallocChunk: 34359707388 kBHardwareCorrupted: 0 kBAnonHugePages: 4096 kBHugePages_Total: 0HugePages_Free: 0HugePages_Rsvd: 0HugePages_Surp: 0Hugepagesize: 2048 kBDirectMap4k: 79740 kBDirectMap2M: 3065856 kBDirectMap1G: 7340032 kB2.atop

The atop command is a monitoring command for a terminal environment. It shows the synthesis of various system resources (CPU, memory, network, Imax O, kernel) and is marked in color under high load.

Sudo atop summarizes various ways to view memory usage under Linux summarize various methods for viewing memory usage under Linux 3.free

The free command is a quick way to view memory usage, and it is an overview of the information gathered by / proc/meminfo.

$free-h4.GNOME System Monitor

GNOME System Monitor is a view tool that shows the usage of CPU, memory, swap, and network in the most recent period. It also provides a way to view CPU and memory usage.

$gnome-system-monitor5.htop

The htop command shows the real-time memory usage of each process. It provides reports on the resident memory size of all processes, the total program memory size, the shared library size, and so on. The list can scroll horizontally and vertically.

$htop6.KDE System Monitor

The function is the same as the GENOME version introduced in 4.

$ksysguard7.memstat

Memstat is a command that effectively identifies the use of virtual memory by executable (s), process (es) and shared libraries. Given a process ID,memstat, you can list executables, data, and shared libraries associated with that process.

$memstat-p8.nmon

Nmon is a ncurses-based system benchmark tool that monitors the interaction patterns of CPU, memory, Imax O, file systems, and network resources. For the use of memory, it can display the total / remaining memory, swap space and other information in real time.

$nmon9.ps

The ps command can display the memory usage of each process in real time. Reported memory usage information includes% MEM (percent of physical memory used), VSZ (totalamount of virtual memory used), and RSS (totalamount of physical memory used). You can use the "- sort" option to sort processes, such as by RSS:

$ps aux | sort-rss

Figure Summary of methods for viewing memory usage under 8:Linux

10.smem

The smem command allows you to count the memory usage of different processes and users based on / proc information. An analysis of memory usage can export charts (such as bar charts and pie charts).

Smem-P sshd-k PID User Command Swap USS PSS RSS 815 root / usr/sbin/sshd 0868.0K 951.0K 1.3M14104 root sshd: root@pts/0 0 2.8M 3.5m 5.3M14292 root python / usr/bin/smem-P ssh 0 5.1M 5.8M 7.2M11.top

The top command provides real-time resource usage statistics for running programs. You can sort according to the use and size of memory.

$top12.vmstat

The vmstat command displays real-time and average statistics, covering CPU, memory, Izod O, and so on. For example, in the case of memory, not only physical memory is displayed, but also virtual memory is counted.

After reading this article, I believe you have a certain understanding of "what are the ways to view memory in the Linux system". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 284

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report