惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

罗磊的独立博客
U
Unit 42
N
Netflix TechBlog - Medium
人人都是产品经理
人人都是产品经理
Hugging Face - Blog
Hugging Face - Blog
腾讯CDC
小众软件
小众软件
V
Visual Studio Blog
T
Tailwind CSS Blog
Engineering at Meta
Engineering at Meta
博客园 - 叶小钗
GbyAI
GbyAI
爱范儿
爱范儿
雷峰网
雷峰网
Microsoft Azure Blog
Microsoft Azure Blog
D
DataBreaches.Net
博客园_首页
D
Docker
A
About on SuperTechFans
G
Google Developers Blog
I
InfoQ
T
The Blog of Author Tim Ferriss
V
V2EX
博客园 - Franky

Feel.name

Centos7安装sngrep – Feel.name DNS大全 – Feel.name Linux下转换文件编码 – Feel.name Linux服务器密钥登陆方法 – Feel.name 升级到最新OpenSSH_9.3p1, OpenSSL 3.1.1 – Feel.name centos 7上创建sftp服务 – Feel.name 通过yum来下载RPM包的方法 – Feel.name 年末守望新年期盼 – Feel.name message 日志里面的“Created slice User Slice of root.”日志去除方法 – Feel.name
linux清理缓存(cache) – Feel.name
Feel · 2023-03-23 · via Feel.name

Skip to content

1)清理pagecache(页面缓存)

# echo 1 > /proc/sys/vm/drop_caches     或者 # sysctl -w vm.drop_caches=1

2)清理dentries(目录缓存)和inodes

# echo 2 > /proc/sys/vm/drop_caches     或者 # sysctl -w vm.drop_caches=2

3)清理pagecache、dentries和inodes

# echo 3 > /proc/sys/vm/drop_caches     或者 # sysctl -w vm.drop_caches=3

注:上面三种方式都是临时释放缓存的方法,要想永久释放缓存,需要在/etc/sysctl.conf文件中配置:vm.drop_caches=1/2/3,然后sysctl -p生效即可!

1. 使用free查看一下当前内存使用情况

total  used   free shared  buff/cache   available

Mem: 31 6 24 0 0 24
Swap: 15 2 12

2. 执行sync同步数据

sync

3. 清理cache

echo 3 > /proc/sys/vm/drop_caches