CentOS free command

Source: Internet
Author: User
Display idle and used memory in the system

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 LinuxFreeTo monitor memory usage.

What is the free command?

FreeCommand is a tool that displays the idle and used memory 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, enterFreeYou can. 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 ignoredBecause it has 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-weight (TB)These units. 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,-gAnd-Timeout.

Display memory information in a readable manner

Free also provides-HOption, which means it is readable to humans (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) option? The biggest difference is that-HThe option adds a readable unit after the number. Let's look at an example.

$ free -h

As we can see, after 1, 0 isG (GB)Letter. When the number does not reach GB, free is smart enough to know and follow the appropriate unit behind each number. TheM-The 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 use-SOption followed by the N seconds 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. 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/meminfoDisplays the memory usage information as a benchmark. As usual, you can enterMan freeTo obtain

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.