Karellism

Clear PageCache and Swap in Linux

Dec 24th, 2019
317
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.24 KB | None | 0 0
  1. #!/bin/bash
  2. # echo 1 = clear pagecache, echo 2 clears dentries and inodes, echo 3 clear Pagecache, dentries and inodes
  3. su -c "echo 3 >'/proc/sys/vm/drop_caches' && swapoff -a && swapon -a && printf '\n%s\n' 'Ram-cache and Swap Cleared'" root
Advertisement
Add Comment
Please, Sign In to add comment