How do you empty the buffers and cache memory on Redhat or Fedora Linux

Emptying the buffers cache

We can signal the Linux Kernel to drop various aspects of cached items by changing the numeric argument to the above command.

  • To free pagecache:
    # echo 1 > /proc/sys/vm/drop_caches
    
  • To free dentries and inodes:
    # echo 2 > /proc/sys/vm/drop_caches
    
  • To free pagecache, dentries and inodes:
    # echo 3 > /proc/sys/vm/drop_caches 
     
     
    If you ever want to empty it you can use this chain of commands.
     
    [root@localhost]#free && sync && echo 1 > /proc/sys/vm/drop_caches && free
    
                  total        used        free      shared  buff/cache   available
    Mem:       16266516     5208028     8793132       96412     2265356    10509976
    Swap:       8269820           0     8269820
                  total        used        free      shared  buff/cache   available
    Mem:       16266516     5209212    10645992       96412      411312    10582088
    Swap:       8269820           0     8269820
     

 

Comments

Popular posts from this blog

How to clean all the foreman task and locked task

CentOS 7 Server Hardening Guide

How to restrict users to send only mail to the local domain in Zimbra