No matter what Linux system or distribution you use, over time it is going to fill with lots of files like unnecessary caches, dependencies, and temporary files. It may happen often if you have a habit of trying out new or alternative applications every day. You’ll be surprised to know that major Linux users do this.
So how to clean the Linux system from such junks, in this article, I’m going to explain some commands that will do all the cleaning job for you. Just make sure what distro you are using, here I’m covering Debian (based) and Fedora.
Manually clean and organize your home directory.
There is no best place other than the home directory to start cleaning your Linux system. The home directory contains all the user’s folders and files. For example, if you download a lot of stuff check the Downloads folder, if you work more on the office files check the Documents folder. Similarly, there are other folders too.
- Desktop – Usually empty if your desktop is clean.
- Documents – Clean and organize.
- Downloads – Clean and organize.
- Music – Clean and organize.
- Pictures – Clean and organize.
- Public – Leave this folder.
- Templates – Usually empty.
- Videos – Clean and organize.
Uninstall unnecessary applications.
There would be dozens of applications on your Linux system; do you use all of them?
If not, then remove those unnecessary applications to get more storage space.
For example, the default Debian install comes with many small-small games that I never use. While Fedora does not come with any extra applications so I have to install some of them.
Remove dependencies and packages that aren’t needed by the system.
If you have installed so many things on your Linux system it would be realizable that many dependencies and packages left orphan there and may not be in use. Just remove it using the ‘autoremove’ command.
Debian (based) users, use the below command:
sudo apt autoremove
Fedora users, use the below command:
sudo dnf autoremove
This will not remove any important thing, so don’t worry. Before removing anything it will show you what it will remove and you will be given a final right (Yes or No) to delete them or not.
There are some other things that can be cleaned but that require little technical knowledge.
I’ll try to cover that in some other article with all the technical details.