Greetings!
Have you ever approached situation when your disk partitions are full and you have delete something? Don't worry; today I'm going to tell you all you need to know about cleaning your Fedora / CentOS / RedHat / similar installations.
Important info
First and foremost, please do back up your system. Especially in cases like this, when you're going to go around system and remove some files - you'd better know that you have back up somewhere in case you occasionally remove something important. Of course, you can always restore the data right away after removing it, but better not to go into this if you can be more careful in the beginning and have back-up as well!
Let's begin
With the back up in place and peace of mind, let's begin our clean-up adventure. What are our steps that we can perform to clean space in Fedora installation?
- You can clean DNF packages that you don't need with:
sudo dnf clean packages
- Clear additional space by removing older parts of system journal:
sudo journalctl --vacuum-size=100M
- It should be safe to remove all files from /var/tmp/* as well as /tmp/*:
rm -rf /var/tmp/* /tmp/*
- If you have Docker installed, remove unused containers:
docker system prune -a
- Check out 20 largest packages (and if you don't need some of them, remove them via dnf or GUI Package Manager of your choice):
rpm -qa --queryformat '%{name} %{size}\n' | sort -n -k 2 -r | head -n 20
- If you see that your system has some languages installed that you don't need, please check out my github gist for more help:
https://gist.github.com/sxiii/674ccd0cbefe25b240e9ef4955442c73
Another things to check is if you have Steam installed, you might want to remove one or several games to make a lot of space at once. Another things to consider is checking your ~/Downloads folder for Linux torrents, music, movies, or whatever you might have downloaded and don't need any more.
Software that might help you
- Very important tool to clean up some space is Baobab:
sudo dnf install baobab && sudo baobab
- Install additional GUI tool called bleachbit to clean up more space. However, check what you remove with it, it can remove some useful stuff too:
sudo dnf install bleacnbit && sudo bleachbit
- You can also check free disk space status by running:
sudo df -lh
If you know other useful commands or programs to clean your Fedora installation, feel free to write them down in the comment section below!
Thanks for reading and I hope this info was useful for you,
Good luck!
@sxiii from Oslo