Wednesday, May 12, 2021

Free up space in ubuntu server

 Clean old kernels

  • Check for kernet is use : uname –r
  • Check for old kernels : dpkg --get-selections | grep linux-image
  • Remove unused kernels : dpkg --get-selections | grep linux-image
Clean APT (Pulled from https://askubuntu.com/questions/5980/how-do-i-free-up-disk-space)
  • To delete downloaded packages (.deb) already installed (and no longer needed)
    • sudo apt-get clean
  • To remove all stored archives in your cache for packages that can not be downloaded anymore (thus packages that are no longer in the repository or that have a newer version in the repository).
    • sudo apt-get autoclean
  • To remove unnecessary packages (After uninstalling an app there could be packages you don't need anymore)
    • sudo apt-get autoremove
Finally, Check Disk Space
  • df -h /