Clear Memory in Linux

This is a script to clear the memory. This script is typically useful for servers that use squid. Squid as a proxy so greedy with memory. Create a file to put this script, for example file “clearmemory”. And place it in the folder /etc/cron.daily/, in order to run automatically every day.

vim /etc/cron.daily/clearmemory.

#!/bin/bash
sync;
echo 3 > /proc/sys/vm/drop_caches

save, and change the permission.
chmod 755 /etc/cron.daily/clearmemory.

Checkthe amount of memory in your computer with the command “top”. And you will see the changes before and after running the file clearmemory.