how to clear centos cache code example
Example 1: linux memory cache clear
# clear pagecache only.
sync; echo 1 > /proc/sys/vm/drop_caches
# clear dentries and inodes.
sync; echo 2 > /proc/sys/vm/drop_caches
# clear pagecache, dentries and inodes.
sync; echo 3 > /proc/sys/vm/drop_caches
Example 2: clear cache yum centos 7
#To clean all cached packages from the enabled repository cache directory
yum clean packages
#To purge the old package information completely
yum clean headers
#To clean any cached xml metadata from any enabled repository,
yum clean metadata
#To clean all the cached files from any enabled repository at once,
yum clean all
#change yum file settings
nano /etc/yum.conf
http_caching=none
Example 3: how to clear memory in ubuntu 18.04
# Clear PageCache, dentries and inodes.
sync; echo 3 > /proc/sys/vm/drop_caches