(evolutive article where I store what's been useful to me to clean space on linux servers I'm using)
Note : my current servers are running Ubuntu.
OS / SystemD : purge logs bigger than ...
Only keep 10M of each log files handle through syslog
sudo journalctl --vacuum-size 10M
OS / apt : remove remnants
Remove automatically all unused packages Remove automatically installed packages not needed anymore (i.e. packages that were installed as dependencies of packages that have now been removed or aren't requiring this dependency anymore)
apt options :
- autoremove - Remove automatically all unused packages
- clean - Erase downloaded archive files
- autoclean - Erase old downloaded archive files
sudo apt-get clean autoremove autoclean
Docker : remove logs older than ...
Only keep the last 1000h of docker containers logs
sudo docker image prune --all --filter "until=1000h" -f
Docker : remove remnants
Be careful ! If your docker environments are not running they might be deleted by some of the following commands !
Remove unused volumes, containers, images, networks, etc.
sudo docker system prune -f
sudo docker system prune -a --volumes