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

To delete old kernel versions

sudo apt-get remove --purge linux-image-X.X.XX-XX-generic

If you don't know which kernel version to remove

dpkg --get-selections | grep linux-image

Source: Limpiando Ubuntu: comandos y programas (actualización) (google translated)


  • Show top 10 biggest subdirs in the current dir.

     du -sk * | sort -nr | head -10
    
  • Use File Usage Analyzer (AKA baobab; GNOME based), Filelight or kDirStat (KDE based), to see where the disk space is going visually (ncdu uses a TUI).

  • Check if you have old kernels for deletion

     ls -lh /boot
    
  • Cleaning packages

     sudo apt autoremove
     sudo apt autoclean
    

    see list of all installed packages, sorted by size. If you see something big and don't use it - uninstall it

     dpkg-query -W --showformat='${Installed-Size} ${Package}\n' | sort -nr | less
    
  • Clean unused language files with translations (there are tons of them)

     sudo apt install localepurge
    
  • Check content of /var/tmp/

     du -sh /var/tmp/
    
  • Check also

     man deborphan
    
  • Search for big files:

     find / -type f -size +1024k
    

    or

     find / -size +50000  -exec ls -lahg {} \;
    
  • Big installed packages (part of the package: debian-goodies)

     dpigs
    

    or wajig sizes | tail -30.

  • On systemd: Remove the oldest archived journal files until the disk space they use falls below the specified size

     sudo journalctl --vacuum-size 10M
    
  • Limit Tracker disk usage.