CentOS free command

Source: Internet
Author: User

CentOS free command

System Administrators must maintain the health of their servers. Memory is an important part. When the server memory usage is too high, it will reduce the server performance. In LinuxFree tool to monitor memory usage.

What is the free command?

The free command is a tool that shows the idle and used memory size in the system. The output of the free command is similar to that of the top command. Most Linux distributions already contain the free command.

How to run free

To run the task, enterFree. Running without the option will display a default output in KB.

$ free

From the above we can see:

Memory (in KB)
  • Total (all): 1026740
  • Used (Used): 843396
  • Free: 183344
  • Shared: 0
  • Buffers (Block device cache): 52704
  • Cached (File Cache): 376384

The difference between Buffers and Cached comes from http://www.taobaotesting.com/blogs/qa? Bid = 2265 is explained as follows:

Buffers is the buffer size for Block devices. It only records the metadata and tracking in-flight pages of the file system.

Cached is used to buffer files.

That is to say: buffers is used for storage. What content and permissions are contained in the directory. While cached is directly used to remember the files we opened.

Swap (in KB)
  • Total (all): 1045500
  • Used (Used): 3376
  • Free: 1042124

When you see low buffer/cache free space or low swap free space, the memory needs to be upgraded. This means that the memory usage is high. Note:Shared Memory columns should be ignored because they have been deprecated.

Display memory information in other units

As we mentioned earlier, free by default will display information in KB. Free is also provided to usB (B),-k (KB),-m (MB),-g (GB) and-memory (TB. To display the desired unit, you only need to select one and follow the free button. The following is an output sample in MB.

$ free -m

This technique also applies-B,-k,-g and-Enabled.

Display memory information in a readable manner

Free also provides-H option, which means it is suitable for human readable (the-h option may not exist on the system and has been replaced by-m ). So what is the difference between this and other options, such-M (MB) Options? The biggest difference is thatThe-h option adds a readable unit after a number. Let's look at an example.

$ free -h

As we can see, after 1, 0 isG (GB) letters. When the number does not reach GB, free is smart enough to know and follow the appropriate unit behind each number. TheThe M-number 929 tells us that it has 929 MB (the original article is 929 number tell us its 969 Megabytes, which should be an input error ).

Show free interval

As a status check tool, the best way to count memory utilization is to use the latency interval. In this case, we can useThe-s option follows the N seconds that we want to interval. We can combine several options later to make the output meet our needs. If we want to count memory utilization every 3 seconds and make it readable to humans, we do this:

$ free -hs 3

Show high/low memory usage

If you want to know the high/low memory statistics, you can use the-l option. The following is an example.

$ free -l

Show all Linux memory

If we need the total information of each column, we can keep up-T option. This will add an additional line at the bottom of the word for display.

$ free -t

Summary

In addition to vmstat, the free command is also a simple statistical tool used to measure memory utilization. With this, you can quickly view your Linux memory information. Use the free command/Proc/meminfo is used as the benchmark to Display memory utilization information. As usual, you can enterMan free

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.