Aravind Prabhakar

Systems Engineer | Networking | Security | PreSales | Cloud | Devops | AIOps

View on GitHub Linkedin Blogs Tags
30 July 2022

Free up memory in Linux

By Aravind

  1. Create a file freemem.sh
  2. Add permissions. chmod +x freemem.sh
  3. execute as ./freemem.sh
root@ubuntu:~# more freemem.sh
sync; echo 1 > /proc/sys/vm/drop_caches
sync; echo 2 > /proc/sys/vm/drop_caches
sync; echo 3 > /proc/sys/vm/drop_caches

Display memory

root@compute21:~# free -h
              total        used        free      shared  buff/cache   available
Mem:           251G         80G         30G        8.1M        139G        168G
Swap:          255G         67M        255G
[ linux  ] tags: linux