Deprecated: Function WP_Dependencies->add_data() was called with an argument that is deprecated since version 6.9.0! IE conditional comments are ignored by all supported browsers. in /home/u763016847/domains/golinuxhub.com/public_html/wp-includes/functions.php on line 6131
How to clear cache in Linux - GoLinuxHub

How to clear cache in Linux

Here I would like to share a script which you can use to clear your cache memory.

IMPORTANT NOTICE:
This is something one should not do as cache is used to speed up your work activity building a cache memory but still if you feel to clear your cache memory size then you can follow the following steps:


Create a script

# vi clearcache.sh
#!/bin/bash
sync; echo 3 > /proc/sys/vm/drop_caches

save and exit

# chmod +x clearcache.sh
Sync should be run beacause this is a non destructive operation and dirty objects are not freeable. So we run sync in order to make sure all cached objects are freed.
echo 1 is clearing only page cache
echo 2 is to clear free dentries and inodes
echo 3 is clearing page cache, dentries and inodes


Follow the below link for more tutorials