Need to clear cached memory for testing/troubleshooting purposes?
The following command clears both directory entry caches (dentries) and inode caches:
echo 1 > /proc/sys/vm/drop_caches && echo 2 > /proc/sys/vm/drop_cachesWhat Does This Command Do?
The command executes two cache-clearing operations:
echo 1 > /proc/sys/vm/drop_cachesThis clears the page cache, which stores file data in memory to improve disk read performance.
echo 2 > /proc/sys/vm/drop_cachesThis clears dentries and inode caches, which Linux uses to quickly locate files and directories.
A Simpler Alternative
Instead of running two separate commands, you can clear both types of caches at the same time:
echo 3 > /proc/sys/vm/drop_cachesThis way you can free all reclaimable caches in one go!
0 Comments