How to clear buff/cache?

0136

You can clear the buffer and cache in Linux using the following command. This requires root privileges, so you may need to use sudo:

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

Explanation:

  • sync: This command flushes the file system buffers, ensuring that all data is written to disk.
  • echo 3 | sudo tee /proc/sys/vm/drop_caches: This command tells the kernel to drop clean caches, dentries, and inodes. The number 3 indicates that all three types of caches will be cleared.

Note:

Clearing the cache can temporarily improve performance for certain applications, but it may also lead to increased disk I/O as the system will need to reload data into the cache. Use this command with caution, especially on production systems.

0 Comments

no data
Be the first to share your comment!