Create a shell script clear.sh using bash.
$ vim clear.sh #!/bin/bash while true do
sync; echo 3 > /proc/sys/vm/drop_cachessleep 5 done
Set execute permissions
$ chmod u+x clear.sh
Now, execute this shell script in the background using “nohup” as shown below. This will keep executing the script even after you logout from your session. This will execute your clear.sh shell script every 5 seconds.
$ nohup ./clear.sh &