How to Clear RAM Memory Cache, Buffer and Swap Space on Linux

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.95/month).
  4. Become a Supporter - Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

46 Responses

  1. Ali Yousefi says:

    Thanks for your useful posts.

    Unfortunately your web is not available in my country (Iran), so we have to use proxy for reading your great posts.

    • Ravi Saive says:

      @Ali,

      Could you tell us, what error you getting while accessing our website? it will be more helpful us to find why the site is getting blocked..

  2. Me says:

    @Stephanie

    Yes, very useful.

    You are getting permission denied because you are running sudo sync, semicolon, this means followed by the echo 1. So you’re running echo not as sudo anymore.

    How about a sudo -i followed by the command.

  3. Yuvakumar says:

    I used ‘sync; echo 3 > /proc/sys/vm/drop_caches‘ in my Linux (RHEL5) and taking more time to execute and come out, also i can see in top command bash process utilization is high of cpu.

    What to do next in this case or shall i kill the process ? can some one help me on it.

  4. Amarnath Datta says:

    Hi there, I am working on my site, hence I have been given this code to clear the cache /serverscripts/clear_cache.sh and now the problem is whenever there is a new article published on site the new article doesn’t appear on site unless I go to putty and go with that command /serverscripts/clear_cache.sh

    so please help me in this, as used some cache plugin but didn’t worked well even some plugin loaded my site RAM, so help me!

  5. Stephanie says:

    Not useful.

    “permission denied”

    Even when root or using sudo.

  6. Stephane says:

    On my Ubuntu 16.04 only the root user can write to /proc/sys/vm/drop_caches and a sudoer user cannot.

    On top of that, even the root user cannot grant write permission on this file.

  7. Abhinav Suryawanshi says:

    When you talk about clearing swap space you say after considering the risk.
    Can you please elaborate more what are the risks in clearing swap space?

  8. Akash Agnihotri says:

    this helped me a lot.. Great work dude !!

Got something to say? Join the discussion.

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