Clear RAM Memory Cache on Ubuntu Linux

Every Linux System has three options to clear cache without interrupting any processes or services.

Log in to the Ubuntu server and enter the root privileges by sudo -i

  1. Clear PageCache only.

     sync; echo 1 > /proc/sys/vm/drop_caches
    
  2. Clear dentries and inodes.

     sync; echo 2 > /proc/sys/vm/drop_caches
    
  3. Clear PageCache, dentries, and inodes.

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

    https://www.tecmint.com/clear-ram-memory-cache-buffer-and-swap-space-on-linux/