How can I safely clean the system from unnecessary files to free up disk space? I mean unnecessary packages, configs, cache, etc.
4 Answers
Remove packages that were automatically installed to satisfy dependencies for some package and that are no more needed:
sudo apt-get autoremove
Clear out the local repository of retrieved package files:
sudo apt-get clean
Remove all files associated with removed packages (if you don’t have aptitude installed do sudo apt-get install aptitude
):
sudo aptitude purge ~c
Remove old kernel versions (thank @waldyrious for this answer):
sudo apt-get purge $( dpkg --list | grep -P -o "linux-(headers|image)-\d\S+" | grep -v $(uname -r | grep -P -o ".+\d") )
Clear the thumbnail cache:
rm -v -f ~/.cache/thumbnails/*/*.png ~/.thumbnails/*/*.png
-
3You can also find useful gCleaner app, in development for elementary OS launchpad.net/gcleaner Commented Aug 7, 2015 at 10:45
CCleaner is not directly available for elementary. You can use BleachBit
for this purpose.
Install bleachbit
from software center.
If you are comfortable with terminal:
sudo apt-get install bleachbit
-
2This is good. I tried to install ccleaner by installing wine and followed by ccleaner Windows setup. But that is not helpful for the Linux. Thanks for finding alternative. Commented Dec 18, 2015 at 7:49
Linux remove unuseful files automaticly way more than windows. An app like CCleaner for windows will not have much work and it is unuseful I think.
It can still detect a very few mistakes, remove the data of your programs (reset them, useful especially if you have got chrome wich stores about 2 GB on my computer even if I am nearly not using it), and see if you have got the same file 2 times at a different place.
You have a few equivalents including bleachbit (supposed to be the best, haven't tried it), you can also use SystemCleanUpTool, fslint and GTKOrphan.