正确理解 output of linux command free
linux command free is used to show the RAM usage of the system. Below is an example output of the command:
$ free -m
total used free shared buffers cached
Mem: 2000 1921 78 0 6 34
-/+ buffers/cache: 1881 119
Swap: 0 0 0
The "-m" switch outputs in megabyte. So the system:
- has total RAM of 2G.
- Used 1921M, but in this Used Mem, it includes 6M as buffers and 34M for cached data.
- Absolutely free (not used by anything) memory is 78M.
- If necessary, the system can use the buffered and cached memory for other processes. Therefore, the actual used memory is "used" - "buffers" - "cached", ie. 1921 - 6 - 34 = 1881M. This is lised on the 2nd line of the output: "-/+ buffers/cache 1881 119".
- Note the "-/+ buffers/cache 1881 119" has a "-/+" at the beginning. I think "-" means what we talked about in point 4. While "+" means that the actual free memory is "free" + "buffers" + "cached" = 78 + 6 + 34 (roughly 119M). Since the system can use that 119M for other processes (at most 119M can be allocated as free memory).
相关推荐
farwang 2020-11-25
星愿心愿 2020-11-24
tianhuak 2020-11-24
zhjn0 2020-11-24
昭君出塞 2020-11-23
bluecarrot 2020-11-23
linuxwcj 2020-10-21
以梦为马不负韶华 2020-10-20
彼岸随笔 2020-10-20
yutou0 2020-10-17
applecarelte 2020-10-16
ourtimes 2020-10-16
waterhorse 2020-09-19
MRFENGG 2020-11-11
rainandtear 2020-10-30
kyssfanhui 2020-10-20
liuhangtiant 2020-10-20