Files
Linux/Docs/Linux清理缓存.md
offends cee91802b3
Some checks failed
continuous-integration/drone Build is failing
synchronization
2025-08-25 15:57:40 +08:00

27 lines
643 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

> 本文作者:丁辉
# Linux清理缓存
Linux 系统有三种选项来清除缓存而不需要中断任何进程或服务。
> 译注Cache译作“缓存”指 CPU 和内存之间高速缓存。Buffer译作“缓冲区”指在写入磁盘前的存储再内存中的内容。在本文中Buffer 和 Cache 有时候会通指。)
- 仅清除页面缓存PageCache
```bash
sync; echo 1 > /proc/sys/vm/drop_caches
```
- 清除目录项和inode
```bash
sync; echo 2 > /proc/sys/vm/drop_caches
```
- 清除页面缓存目录项和inode
```bash
sync; echo 3 > /proc/sys/vm/drop_caches
```