Free up disk space


List folder size and corresponding file sizes

du -chd 1 | sort -h    
du -aBM 2>/dev/null | sort -nr | head -n 50 | more

# use du's -x flag to keep things limited to one filesystem 
# 2>/dev/null redirects any error messages into oblivion. If they don't bother you, it's not obligatory.
sudo du -sx /* 2>/dev/null | sort -n

# List all files larger than 1000MiB
find / -size +1000M -ls

Clean Ubuntu

# 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

# Install bleachbit 
sudo apt-get install bleachbit

# Open bleachbit and select files to clean 
# 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

Clean conda

Anaconda accumulate lots of garbage package caches and tarballs.

conda clean

# To delete caches, tarballs and lock files which are not used (except tmp)
conda clean -iptf

# To delete all
conda clean -a