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 [[email protected] ~]# free2 used free shared buffers Cached3 Mem: 8062392 2092832 5969560 0 187132 14988324 -/+ buffers/cache: 406868 76555245 Swap: 2097148 0 2097148
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 chestnuts used by the free command
1. Display memory in megabytes (common)
This is very good to remember, that is,-m:
1 [[email protected] ~]# free-m2total used free Shared buffers cached3 Mem: 7873 2043 5829 0 182 1463 4 -/+ buffers/cache: 397 74765 Swap: 2047 0 2047
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 [[email protected] ~]# free-b2total used free Shared buffers cached3 Mem: 8255889408 2142736384 6113153024 0 191623168 15348039684 -/+ buffers/cache: 416309248 78395801605 Swap: 2147479552 0 2147479552
3. Show total usage
With the-t parameter, more than one line of total is used to display the overall usage:
1 [[email protected] ~]# free-t2total used free shared buffers Cached3 Mem: 8062392 2092516 5969876 0 187132 14988324 -/+ buffers/cache: 406552 76558405 Swap: 2097148 0 20971486 total: 10159540 2092516 8067024
4. Turn off the display buffer line
You can turn off the display of the second row by using the-o parameter:
1 [[email protected] ~]# free-o2total used free shared buffers Cached3 Mem: 8062392 2092764 5969628 0 187132 14988324 Swap: 2097148 0 2097148
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 [[email protected] ~]# free-o2total used free shared buffers Cached3 Mem: 8062392 2092764 5969628 0 187132 14988324 Swap: 2097148 0 2097148
6. additional statistics showing low and high memory
Additional low and high memory size statistics are shown using the-l parameter:
1 [[email protected] ~]# free-l2total used free shared buffers Cached3 Mem: 8062392 2092516 5969876 0 187132 14988324 Low: 8062392 2092516 59698765High: 0 0 0 6 -/+ 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 [[email protected] ~]# free-v2 Procps version 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 ~
Blog Address: http://www.cnblogs.com/voidy/
Blog: http://voidy.net
<. ))) ≦
Play Linux within storage management-free