Comments on: How to Clear RAM Memory Cache, Buffer and Swap Space on Linux https://www.tecmint.com/clear-ram-memory-cache-buffer-and-swap-space-on-linux/ Tecmint - Linux Howtos, Tutorials, Guides, News, Tips and Tricks. Fri, 27 Sep 2024 05:49:44 +0000 hourly 1 By: Ravi Saive https://www.tecmint.com/clear-ram-memory-cache-buffer-and-swap-space-on-linux/comment-page-1/#comment-2220939 Fri, 27 Sep 2024 05:49:44 +0000 http://www.tecmint.com/?p=13515#comment-2220939 In reply to urostor.

@Urostor,

Thanks for the correction! I’ll use the proper command with ‘sudo‘ and ‘tee‘ to ensure the necessary permissions are applied when modifying cache settings.

]]>
By: urostor https://www.tecmint.com/clear-ram-memory-cache-buffer-and-swap-space-on-linux/comment-page-1/#comment-2220151 Wed, 25 Sep 2024 07:04:48 +0000 http://www.tecmint.com/?p=13515#comment-2220151 These commands are incorrect.

You cannot directly echo to /proc/sys/vm/drop_caches as a regular user.

The correct command should be:

sudo sync; echo 1 | sudo tee /proc/sys/vm/drop_caches

This ensures you have the necessary permissions to modify the cache settings.

]]>
By: Tony jack https://www.tecmint.com/clear-ram-memory-cache-buffer-and-swap-space-on-linux/comment-page-1/#comment-2219108 Sun, 22 Sep 2024 19:25:04 +0000 http://www.tecmint.com/?p=13515#comment-2219108 To clear RAM cache, buffer, and swap space on Linux, use the following commands:

Clear PageCache:

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

Clear Dentries and Inodes:

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

Clear PageCache, Dentries, and Inodes:

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

Clear Swap Space:

swapoff -a && swapon -a

Always use sync to avoid data loss. These commands help free up system memory without impacting performance.

]]>
By: Rich https://www.tecmint.com/clear-ram-memory-cache-buffer-and-swap-space-on-linux/comment-page-1/#comment-2196478 Tue, 30 Jul 2024 03:28:03 +0000 http://www.tecmint.com/?p=13515#comment-2196478 In reply to alex.

You need to add sudo like so:

sudo sync; echo 1 | sudo tee /proc/sys/vm/drop_caches
]]>
By: Ravi Saive https://www.tecmint.com/clear-ram-memory-cache-buffer-and-swap-space-on-linux/comment-page-1/#comment-2186943 Fri, 05 Jul 2024 04:14:27 +0000 http://www.tecmint.com/?p=13515#comment-2186943 In reply to KUSHAGRA JAGER.

@Kushagra,

Exactly. Clearing the cache while programs are running can remove essential files, leading to crashes and data corruption.

]]>