Ubuntu / Linux cleanup disk space

Date: 2022-05-23
# run with sudo 

# remove apt cache
apt-get clean
# full-remove unused packages (old kernels etc.)
apt-get autoremove --purge
# remove journal log older than 2 days
journalctl --vacuum-time=2d
# remove thumbnail cache or other files from the user-cache folder
rm -rf ~/.cache/thumbnails/


# find all log files (not directories see -type f) in /var/log older than 30 days
sudo find /var/log/ -type f -mtime +30
# verify the list an then delete all log files in /var/log older than 30 days
sudo find /var/log/ -type f -mtime +30 -delete

# delete empty directories
sudo find /var/log/ -type d -mindepth 1 -empty -delete

https://github.com/oguzhaninan/Stacer

62160cookie-checkUbuntu / Linux cleanup disk space