How to fix cache on Ubuntu

Clearing a cache on Linux Ubuntu

There are all total of three stages of clearing a cache on Linux Ubuntu.

Open your terminal with Ctrl + Alt + t and follow the given below steps:

  1. Clear Page Cache:
  2. Clear inodes and dentries:
  3. And clear inodes, page cache and dentries:

Talking about the above steps. Ubuntu supports bash rather than sync. And command separated by ; runs in a flow.  As we know that terminal waits for another commands sequentially which will help to reduce the work flow. We are using echo for writing in the file and also drop_caches will help to kill the cache without closing any software or application.

After that you have to create a file on terminal which is clearcache.sh which will help to auto clear RAM on a certain basis. And you have to add below command on this file:

 

And now set execution permission on clearcache.sh file

Now, you have to clear RAM cache. Set cron to clear your RAM on daily basis by opening crontab.

And after that a file will be opened. You just have to go to the last line of the code and have to append a new code.

Now it’s time for clearing a swap space in Linux.

Just run the above code to clear a swap space on Ubuntu or any Linux

After that, just copy the below code and paste it on your terminal:

After successfully running it, run command :

It will show you your space before and after running the command.

 

Leave a Reply

Your email address will not be published. Required fields are marked *