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

推荐订阅源

Vercel News
Vercel News
F
Fortinet All Blogs
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
GbyAI
GbyAI
MongoDB | Blog
MongoDB | Blog
Jina AI
Jina AI
aimingoo的专栏
aimingoo的专栏
I
InfoQ
IT之家
IT之家
罗磊的独立博客
Blog — PlanetScale
Blog — PlanetScale
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
The Cloudflare Blog
爱范儿
爱范儿
Microsoft Azure Blog
Microsoft Azure Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
美团技术团队
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
B
Blog RSS Feed
G
Google Developers Blog
大猫的无限游戏
大猫的无限游戏
博客园_首页
Engineering at Meta
Engineering at Meta
Martin Fowler
Martin Fowler

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