This has been asked earlier but don't want to update the same thread again as it was a old thread .
Want to clarify myself on the "buffers" and "cache" column from the output of free command.
This is what my understanding...
Buffer is something where data is there in memory but yet to be flushed to disk .
The data will be flushed to disk by bdflush daemon periodically or we can do it manually by running sync command .
Cache on the other hand is program/data which is loaded into memory but is retained in memory so that if is needed again , it will be quickly available.
To understand the concept of buffers , I tried the following experiment...
This is the reading of free command in my desktop
[zama@localhost ~]$ free -m
total used free shared buffers cached
Mem: 2897 465 2431 0 30 230
-/+ buffers/cache: 204 2692
Swap: 4000 0 4000
[zama@localhost ~]$ sync
[zama@localhost ~]$ free -m
total used free shared buffers cached
Mem: 2897 466 2431 0 30 230
-/+ buffers/cache: 205 2691
Swap: 4000 0 4000
Here I cannot see buffer getting reduced after executing the sync command.
Next I tried the following...Tried to write a huge file to the disk .
[zama@localhost ~]$ dd if=/dev/zero of=test bs=1024k
As expected , the cached value should increase and free is confirming this..
@localhost ~]# free -m
total used free shared buffers cached
Mem: 2897 1466 1430 0 32 1127
-/+ buffers/cache: 306 2590
Swap: 4000 0 4000
I again executed the sync