linux清除cache的2种方法
来源:互联网 发布:截获特定端口的数据包 编辑:程序博客网 时间:2024/06/14 01:43
今天去面试,被问到linux下如何清除cache,一脸懵逼,因为是真的不知道,但记得用sync命令可以把内存中的数据写入硬盘,就这样说了,面试的技术好像不满意,下来之后查了查,原来还有/proc/sys/vm/drop_caches这个文件可以。
网上查了查资料,整理一下:
关于drop_caches文件:系统默认为0
在Documentation/sysctl/vm.txt中有如下描述:
drop_caches
Writing to this will cause the kernel to drop clean caches, dentries and inodes from memory, causing that memory to become free.
To free pagecache:仅清除页面缓存(PageCache)
echo 1 > /proc/sys/vm/drop_caches
To free dentries and inodes:清除目录项和inode
echo 2 > /proc/sys/vm/drop_caches
To free pagecache, dentries and inodes:清除页面缓存,目录项和inode
echo 3 > /proc/sys/vm/drop_caches
As this is a non-destructive operation and dirty objects are not freeable, the user should run `sync' first.
我面试完,我看技术给我的答案上写的是echo 1 > /proc/sys/vm/drop_caches,大家看着记住就好,其实我说sync也没错的,对吧
- linux清除cache的2种方法
- linux中清除cache的方法
- 怎么清除linux的内存和cache
- 清除 linux服务器的buffer和cache
- Linux如何清除系统cache
- Linux如何清除系统cache
- Linux 清除内存中的cache
- linux设置定时清除buff/cache的脚本
- Magento清除缓存(clear cache)和创建缓存(create cache)的方法
- linux如何清除系统的cache buffer与cache的区别
- ui5 清除controll的cache
- Linux系统清除Grub的几种方法
- Linux---强制清除cache和buffer
- linux 下面清除历史纪录的方法
- linux清除文件内容最快的方法
- 清空linux cache的方法
- Linux --- 清理内存和Cache的方法
- 清除cache
- D-BUS编译
- EJS模版的使用
- js 实现倒计时
- hibernate入门学习(一)
- Akka MapReduce 去停词单词统计
- linux清除cache的2种方法
- bootstrap-table.js如何根据单元格数据不同显示不同的字体的颜色
- 修改状态栏颜色
- 逻辑回归
- Eclipse-拷贝绝对路径
- 插件化-apk动态加载
- Web基础之CSS入门
- 运算符
- Quartz2.2.1+Spring+MYSQL实现表达式任务持久