Liberian Geek
  • Home
  • How-To/Tips
  • Linux
  • Windows

Easily Free Up Linux System Cache In Memory

Here’s a tip for webmasters and blog owners that will show you how to easily free up systems’ caches in memory using Linux. This usually will come in handy if you’re want immediate results after making changes to your website’s codes.

For example, if you run a WordPress blog with W3 Total Cache installed and functioning great. All your web’s content are being cached and served to clients via W3TC. You made some changes to your website codes and after emptying W3 Total Cache’s folder, the changes are still be being applied to your site. Your webserver is still serving cached content. In order to immediately empty all cached content in the system’s memory, you may want to  run these commands below.

First, check to see if you have cached content in memory. To do that, run the commands below.

free -m

 

empty_cache_content

 

After running the above command, you’ll see information about your system’s memory (free / used) and cached content.

Before running the command, check to see the current value for Linux kernel drop_caches. It should be 0. Run the commands below to check.

cat /proc/sys/vm/drop_caches

 

Now, to immediately free up all cached content, including dentries, inodes run the commands below.

sudo sh -c "sync; echo 3 > /proc/sys/vm/drop_caches"

 

empty_cache_content_1

 

The above commands changes the value to 3 from 0.

After the cached content are removed, change it back to 0 by running the commands below.

sudo sh -c "sync; echo 0 > /proc/sys/vm/drop_caches"

 

With other Linux systems like CentOS or openSUSE, you may want to run this as root.

 

sh -c "sync; echo 0 > /proc/sys/vm/drop_caches"

 

Now check again.

 

Enjoy!


Related Posts

  • View A List Of Changed/Updated Packages In Fedora, CentOS, Red Hat Linux
  • Setting The Correct Timezone In CentOS And Ubuntu Servers With NTP
  • LibreOffice 4.0 Has Just Been Released–How To Install It In Windows, Mac and Ubuntu
  • Get Original / Real IPs From Clients With WordPress Behind HTTP Proxy Or Load Balancer
  • XBMC 12.0 ‘Frodo’ Released: How To Install It In Windows, Mac And Ubuntu Systems

Home > How-To/Tips, Linux, Web - 11 February 2013
Tweet
Got anything to say? Go ahead and leave a comment!
  1. C. Alexandru Ionut says:
    February 12, 2013 at 6:17 PM

    For me, is still 3.. What can i do?

    Reply
Comment Below!
Click here to cancel reply.



Follow @liberiangeek

Recent Posts
    • Say Yes To Google Play Music Manager In Ubuntu 13.04 Raring Ringtail
    • Delete Junk, Improve Performance And Increase Privacy With BleachBit In Ubuntu 13.04 Raring Ringtail
    • Firefox 21 Released For Windows, Mac And Linux Systems
    • How Can You Find System Information In Ubuntu 13.04 Raring Ringtail
    • Is There A Better Task Scheduler In Ubuntu 13.04 Raring Ringtail?
    • Want LAMP (Linux, Apache, MySQL, PHP) In Ubuntu 13.04?
    • Support For Ubuntu 10.04 / 11.10 Desktop And 8.04 Server Edition End Today
    • Want uTorrent In Ubuntu? You May Have To Settle For qBittorrent Instead
    • LibreOffice 4.0.3 Released–Third Minor Release Of LibreOffice 4.0 Family
    • Why Do We Still Need GUI Tools To Manage Groups In Ubuntu?

    Copyright © 2009 - 2013 Liberian Geek        Privacy Policy |      About Us |      Contact Us |      Search

    ↑ Top