Play Linux within storage management-free
The free command displays the idle, used physical memory and swap memory in the Linux system, and the buffer used by the kernel. In Linux system monitoring tools, the free command is one of the most frequently used commands. Here is a free command for chestnuts:
1 [Root@compute ~]# free2 Total used free shared buffers Mem: 8062392 14988324-/+ buffers/cacheSwap2097148
The following is a description of the output information for this command:
First line: Shows the details of the memory, such as total memory, used memory, free memory, memory shared by multiple processes, memory for buffers, and memory for caching.
Second line: Shows the total buffer memory/cache memory usage and idle condition. Use the second row of used total memory (2092832)-used buffer Memory (187132)-used buffer Memory (1498832) =406868. Idle is the cache/buffer memory (406868) of totals (8062392)-used = 7655524.
The third line shows the total swap area total memory, used, and idle memory. The swap area is the virtual memory created on the HDD to increase the virtual memory size. So here's the question:
What is the difference between a buffer and a cache?
Buffers are places where data is temporarily stored for a particular application, and the data cannot be used by other applications. This is quite similar to the concept of bandwidth. When you try to transmit bursty data over the network, if your network card can only send a small amount of data, it can put such a large amount of data in the buffer, so that it can be accepted by the lower network card to send the data. On the other hand, caching is something that stores frequently used data for faster access. The other difference is that the cache can be used multiple times and buffers can only be used once. But they all provide a temporary storage for your data processing. Here are some examples of how to use chestnuts.
The free command uses chestnuts 1. Display memory in megabytes (common)
This is very good to remember, that is,-m:
1 [Root@compute ~]# free-m2 Total used free shared buffers Mem: 7873 14634-/+ buffers/cacheSwap2047
2. Also display memory in bytes, kilobytes, and gigabytes (infrequently used)
Use the-B,-K,-G parameters to display the size of the memory in bytes, kilobytes, and gigabytes:
1 [Root@compute ~]# free-b2 Total used free shared buffers Mem: 15348039684-/+ buffers/cacheSwap2147479552
3. Show total usage
With the-t parameter, more than one line of total is used to display the overall usage:
1 [Root@compute ~]# free-t2 Total used free shared buffers Mem: 8062392 14988324-/+ buffers/cacheSwaptotal8067024
4. Turn off the display buffer line
You can turn off the display of the second row by using the-o parameter:
1 [Root@compute ~]# free-o2 Total used free shared buffers Mem: 8062392 Swap2097148
5. Update current memory usage at a fixed time interval
Plus the-s parameter, and then add an integer to the-s parameter to update the memory usage in the periodic interval, below I will raise a chestnut, rounding up an integer bar, updated within 1024s:
1 [Root@compute ~]# free-o2 Total used free shared buffers Mem: 8062392 Swap2097148
6. Additional statistics showing low and high memory
Additional low and high memory size statistics are shown using the-l parameter:
1 [Root@compute ~]#FREE-L2 total used free shared buffers cached3Mem: 8062392 2092516 5969876 0 187132 14988324 low: 8062392 209 2516 59698765 high: 0 0 -/+ buffers/cache: 406552 76558407 Swap: 2097148 0 2097148
7. View the version of the free command
Use the-v parameter to display version information:
1 [Root@compute ~]#3.2. 8
Above.
Reference: http://www.linuxnix.com/2013/05/find-ram-size-in-linuxunix.html
http://www.tecmint.com/check-memory-usage-in-linux/
PS: This blog Welcome to forward, but please specify the blog address and author, because I level limited, if there is wrong, welcome point, Thank you ~
- This article is from: Linux Tutorial Network
Play Linux within storage management-free