Linux Clearing Storage
df, autoclean & logs
Clear log files - one liner
sudo truncate -s 0 /var/log/*log
Truncate files using loop
you can create .sh file and chmod +x and insert the below into it
for logfile in $(ls /var/log/*.log)
do
truncate -s 0 $logfile
done
Check space after deletion
clean and du with max depth
sudo du -h --max-depth=1 | sort -h
rm -rf ~/.cache/thumbnails/*
sudo apt-get autoclean
sudo apt-get clean
sudo apt-get autoremove
purging a package
Fill in package name to purge
sudo apt-get remove --purge <PACKAGENAME>
Popularity Contest
popularity-contest
sudo apt install popularity-contest
cd /var/log
sudo touch popularity-contest
sudo chmod 666 popularity-contest
sudo popularity-contest > /var/log/popularity-contest
popcon-largest-unused
Now you can delete packages that are big in size and unused
sudo apt-get remove --purge <PACKAGENAME>