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 freeTo 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 unitsAs 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 mannerFree 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 intervalAs 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 usageIf 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 memoryIf 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
SummaryIn 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