Home Linux Clear Cache Memory in Linux Without Rebooting

Clear Cache Memory in Linux Without Rebooting

by Noyal S
Clear Cache

Clearing cache memory in Linux is a common task that is often necessary to improve system performance or to troubleshoot issues. One way to clear cache memory without having to reboot the system is by using the sysctl command. The sysctl command can be used to configure kernel parameters at runtime, which allows for various system settings to be adjusted without having to reboot the system.

To clear the cache memory in Linux, you can use the following command:

root@twenty ~]# sync && sudo sysctl -w vm.drop_caches=3 && sudo sysctl -w vm.drop_caches=0

The command is made up of three parts:

  1. sync – This command is used to flush any pending cache data to disk, ensuring that any changes made to the cache are saved before it is cleared.
  2. sysctl -w vm.drop_caches=3 – This command is used to clear all caches, including the page cache, dentries, and inodes.
  3. sysctl -w vm.drop_caches=0 – This command is used to reset the drop_caches parameter, effectively stopping any further clearing of the cache.

You can forcefully clear the Cache in Ram using the syctl.

root@twenty ~]# sync && sudo sysctl -w vm.drop_caches=3 && sudo sysctl -w vm.drop_caches=0

1. sync –> Pending cache is flushed onto disk

2. sysctl -w vm.drop_caches = 3 –> Clear all caches

3. sysctl -w vm.drop_caches = 0 –> Reset the drop_caches to no clearing

It’s worth mentioning that this method is a powerful tool that can free up a significant amount of memory, but it’s important to use it with caution, as it can cause some performance degradation.

In summary, Clearing cache memory in Linux can be done without rebooting the system by using the sysctl command. This command allows you to clear all caches, including the page cache, dentries, and inodes. It’s important to use this method with caution and follow the instructions carefully, if you have any doubts, contact SupportPRO Server Admin for help.

guy server checkup

Need help with your servers?

Contact Us today!

Leave a Comment

CONTACT US

Sales and Support

Phone: 1-(847) 607-6123
Fax: 1-(847)-620-0626
Sales: sales@supportpro.com
Support: clients@supportpro.com
Skype ID: sales_supportpro

Postal Address

1020 Milwaukee Ave, #245,
Deerfield, IL-60015
USA

©2022  SupportPRO.com. All Rights Reserved