Clearing RAM Memory Cache, Swap Space and Buffer on Ubuntu

Introduction

When working with an Ubuntu server, we must occasionally clear the Ubuntu cache memory, which is critical for running applications because it provides smooth performance and can save hardware resources.

In this post, we will clear cache memory, Swap Space and Buffer on Ubuntu OS.

Step 1: Clear PageCache

You need to use the given command to clear PageCache, With Root privileges.

Note :- These command do not interrupting any processes and services.

To take root access.

$ sudo -i

To clear the memory.

sync; echo 1 > /proc/sys/vm/drop_caches

Step 2: Clear Inodes and Dentries

Use the following command for that.

sync; echo 2 > /proc/sys/vm/drop_caches

Step 3: Clear PageCache, Inodes and Dentries

Execute the following command for that.

sync; echo 3 > /proc/sys/vm/drop_caches

Conclusion

We have successfully Clear the cache memory on Ubuntu 22.04 LTS Kindly report in case you are facing difficulties with following details.

  • OS name
  • OS version
  • Package name
  • Logs – Error / Warning / failed
Clearing RAM Memory Cache, Swap Space and Buffer on Ubuntu

2 thoughts on “Clearing RAM Memory Cache, Swap Space and Buffer on Ubuntu

Leave a Reply

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

Scroll to top