Linux memory monitoring

Source: Internet
Author: User

Linux memory monitoring is one of the most important resources managed by Linux kernel. The memory management system is the most important part of the operating system, because the physical memory of the system is always less than the amount of memory required by the system. Virtual Memory is the strategy used to overcome this conflict. By sharing memory among processes, the system's virtual memory seems to have more memory than the actual memory.

(1) Linux memory monitoring: monitors memory usage in real time

Use the "Free" command on the command line to monitor memory usage

 
 
  1. #free  
  2. total  used  freeshared    bufferscached  
  3. Mem:256024192284 63740  0 10676101004  
  4. -/+ buffers/cache: 80604175420  
  5. Swap:  522072  0522072  

The above shows a 256 mb ram and a 512 MB swap space system. The third row of output (Mem :) displays the physical memory. The total column does not display the core physical memory (usually about 1 MB ). The used column shows the total memory used (the second row does not count as a buffer ). The free column shows all unused memory. The Shared column displays the total memory Shared by multiple processes. The Buffers column displays the current disk cache size. The information displayed on the fifth line (Swap :) is similar to the above. If the behavior is 0, no swap space is used. By default, the free command displays memory usage in kilobytes (that is, 1024 bytes. Available? The h Parameter displays memory usage in bytes, or can it be used? The m parameter displays memory usage in MB. Can also pass? The s parameter uses commands to continuously monitor memory usage:

# Free? B? S2

This command continuously reports memory usage in the terminal window and updates every 2 seconds.

(2) Linux memory monitoring combo watch? The free command is used to monitor memory usage in Real Time:

 
 
  1. #watch -n 2 -d free  
  2. Every 2.0s: freeFri Jul 6 06:06:12 2007  
  3. total  used  freeshared    bufferscached  
  4. Mem:233356218616 14740  0  5560 64784  
  5. -/+ buffers/cache:148272 85084  
  6. Swap:  622584  6656615928  

The watch command runs free once every two seconds. The screen is cleared before execution and data is displayed in the same position. Because the watch command does not scroll the screen, it is suitable for monitoring memory usage for a long time. You can use the-n option to control the execution frequency. You can also use the-d option to display commands in different places each time. The Watch command is executed until you press [Ctrl]-[C.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.