foreword

  • This article was tested under Ubuntu 20.04

View cache

fincore

  • See how big a single file is in the cache

     fincore filename
  • Check how big all files in the directory are in the cache

     ls ./ | xargs fincore
  • Recursively view the cache of all files in a directory

     find ./ -type f | xargs fincore

vmtouch

  • See how big a single file is in the cache

     vmtouch filename
  • Check how big all files in the directory are in the cache

     vmtouch ./

pcstat

hcache

This article is from qbit snap

Empty the cache

Just empty the PageCache

 sync; echo 1 > /proc/sys/vm/drop_caches

Empty only dentries and inodes

 sync; echo 2 > /proc/sys/vm/drop_caches

Also empty PageCache, dentries and inodes.

 sync; echo 3 > /proc/sys/vm/drop_caches
This article is from qbit snap

qbit
268 声望279 粉丝