Clearing Memory Cache, Buffer and Swap Space

Clearing PageCache

This command will clear the PageCache, helping to free up the memory resources.

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

Clearing Dentries and Inodes

This command will sync the filesystem and clear both dentries and inodes, improving system performance by releasing cached directory and inode information.

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

Clearing PageCache, Dentries, and Inodes

This command will sync the filesystem and clear the pagecache, dentries, and inodes, helping to free up memory and improve system performance.

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

Clearing Swap Space

To clear swap space, use the swapoff command with the -a option, which will disable all swap partitions.

swapoff -a

Then, turn it back by running the following command, which will activate all swap partitions.

swapon -a

Last updated

Was this helpful?