linux free - free结果分析

【基本介绍】
free - Display amount of free and used memory in the system.free是用来显示系统内存交换内存使用情况的命令。这里我们分析free的结果。

【命令参数】
[root@xxx xxx]# free -h
free: invalid option -- h
usage: free [-b|-k|-m|-g] [-l] [-o] [-t] [-s delay] [-c count] [-V]
  -b,-k,-m,-g show output in bytes, KB, MB, or GB
  -l show detailed low and high memory statistics
  -o use old format (no -/+buffers/cache line)
  -t display total for RAM + swap
  -s update every [delay] seconds
  -c update [count] times
  -V display version information and exit


一般使用free -m显示单位MB大小的使用情况
[root@fantawebn004 nginxlog]# free -m
             total       used       free     shared    buffers     cached
Mem:          3955       3712        242          0        459       2028
-/+ buffers/cache:       1224       2730
Swap:            0          0          0


【结果分析】
第2行Mem: 内存总数是3955M,已经使用3712M,剩余242M , buffers459M cached2028M
    内存总数=已经使用+剩余内存
   从系统角度看内存的使用量
第3行-/+ buffers/cache:  已经使用1224M ,剩余2730M
    从应用的角度看内存使用量
    已经使用内存=应用使用内存+buffers+cached
    3721 = 1224 + 459 + 2028
第4行Swap: 交换区

A buffer is something that has yet to be "written" to disk.
A cache is something that has been "read" from the disk and stored for later use.


【参考】
http://www.cnblogs.com/coldplayerest/archive/2010/02/20/1669949.html

猜你喜欢

转载自runpanda.iteye.com/blog/2106277