Understanding the Differences Between Buffer and Cache in Linux
“Why does my free command show so much memory usage, yet the system is not slow?”“Can both Buffer and Cache be released?”“Is Linux stealing my memory?”
Many newcomers to Linux are often puzzled when they see the memory usage of the system. This article aims to clarify once and for all—What are the differences between Buffer and Cache?

🔍 1. First, let’s look at the output of the free command
$ free -h
total used free shared buff/cache available
Mem: 16Gi 2.3Gi 1.2Gi 200Mi 12Gi 13Gi
You might be surprised to find:
🤔 “How come my 16G memory has 12G in buff/cache?!”
Don’t worry, this is actually Linux’s “smart usage”, and does not mean it is truly occupied.
🧱 2. What is Buffer?
✅ Buffer is for speeding up “disk writes”!
- • Writing data to disk is usually quite slow
- • Linux temporarily stores the data to be written in memory (this is the Buffer)
- • When the system is idle, it writes to disk in batches (improving performance)
📌 For example:
When you cp a large file, Linux first puts it in the Buffer and later writes it to the hard disk.
🧠 3. What is Cache?
✅ Cache is for speeding up “disk reads”!
- • If you have accessed a certain file, Linux will cache it in memory
- • On the next access, it will read directly from memory, which is very fast
- • This part is called Page Cache, commonly referred to as Cache
📌 For example:
When you cat a log file, Linux caches it in the Cache, so it won't read from the disk again next time.
🔍 4. The Essential Differences Between Buffer and Cache
| Comparison Item | Buffer | Cache |
| Main Function | Temporary buffer for writing data | Cache area for reading data |
| Usage Scenario | Disk write optimization | Disk read optimization |
| Type | Block device cache | File system cache |
| Lifecycle | Can be released after writing | May reside long-term until memory is tight |
| Can it be released? | Yes, the system dynamically recycles based on memory pressure | Yes, a recycling mechanism also exists |
🧪 5. You Can Manually Release Them
# Release Page Cache, directory entries, and inodes simultaneously
sudo sync; echo 3 > /proc/sys/vm/drop_caches
| Parameter Value | Meaning |
| 1 | Release page cache |
| 2 | Release directory entries and inodes |
| 3 | Simultaneously release Page Cache and Buffer |
⚠️ Note: This is not an optimization method, and frequent use is not recommended; it is only for debugging or testing.
🧰 6. How to Determine if Cache is Effective?
Using <span>vfsstat</span> or <span>iostat</span> tools, you can see the actual hit rate:
# Check disk read/write status
iostat -x 1
# Check file system hit rate
cat /proc/meminfo | grep -E 'Cached|Buffers'
You will find that many files do not access the disk on the second visit, resulting in a significant performance boost.
Conclusion
✅ Buffer is a transit station for “writing to disk”, while Cache is an accelerator for “reading from disk”.✅ Although it seems to occupy a lot of memory, it is actually Linux utilizing “idle memory” to enhance system performance.
Previous Articles
-
100 High-Frequency Linux Operations Commands, Recommended for Collection!
-
Differences Between GPU and CPU
-
Comprehensive Guide to Firewalld: Principles + Practice, Easily Manage Linux Firewall!
-
Common Network Commands for Linux Operations
-
Differences Between TLS and SSL
-
Common Commands for Kirin System V10
-
Cleaning Up Unused Docker Images or Images Tagged as None
-
Is the Service Problematic When Tomcat Thread Count Exceeds 350?
-
Resolving MySQL Master-Slave Synchronization Issues with Percona Toolkit
-
Differences Between Chip Architectures: X86, ARM, RISC-V, MIPS, POWERPC, SPARC
-
What Are the Master Components of K8S? What Is the Role of Each Component?