Monday, January 26, 2015

How to clear cache memory in Ubuntu

Since my Ubuntu 14.04 was storing a lot of cache in memory (as far as I remember it was 1.5 GB, or maybe more than that), I was looking for a solution. For those computers having a limited memory below 4 GB and used heavily, caching a lot may cause trouble. Though it becomes more faster, but for me it made my computer ran slowly.

I was looking for a permanent solution. Then I made a script which will make a soft link indicating itself and will drop cache. No need to write "sudo sync; sudo echo 3 > /proc/sys/vm/drop_caches" every time in terminal, which I found complex to memorize.

Below script will download an script, save it in '/usr/local/share/' directory and then execute it. Actually the downloaded script will make a soft link in '/usr/local/bin/' directory to make it more easier and interactive. It can be deployed in any machine which supports BASH such as UNIX or Linux. Additionally the machine must be connected to the internet as it downloads original script from github.

Copy and paste it into terminal


Original source code is available in my github account:
https://github.com/Nabid/Shell_Scripts/tree/master/Drop_Cache

Tested in Ubuntu 14.14 Trusty Tahr.



The scripts in this post and in the github link given above, can be used, modified or changed for only educational purposes. The author is not responsible for any kind of damage or data loss.

No comments:

Post a Comment

Thanks - Jajabor, 2014