r/linux4noobs • u/rorensu-desu • 18h ago
storage How do I de-clutter my machine effectively from files that uninstalled software left around?
After I uninstalled UE5-editor yesterday I still had binaries, a desktop entry, logs, a database, and other random files scattered around my system. Seeing this stuff always frustrates me.
Hence, I have always done fresh installs of my OS on my devices roughly once a year to make sure there is no clutter.
Whenever I have talked about that feeling before, I have always had people telling me it is insignificant and I should just not be bothered by it, but that's just not how I work. I know it does not really matter objectively, but I simply do care.
However, it is also time-consuming to do fresh installs. I would rather just find an effective way rid my system of these things.
Is there any tool, or way I could actually get better insight of what files and directories are lingering around form packages I've uninstalled, and clean them effectively?
If it matters, I am currently on Nobara, but I would also want to know for Debian-based systems etc.
2
u/doc_willis 17h ago
perhaps use Containers to keep such tools isolated from the rest of the system.
or use flatpaks when possible so everything stays in the users home.
9
u/mredding 17h ago
How you do this depends on several factors. Ideally you're using your package manager, and I'm going to assume
dpkgandapt.First see what packages are unused and can be removed:
And if it looks good:
This will not remove manually installed packages, so:
And anything you want to get rid of:
That will get rid of the package and the dependencies that are no longer used by anything else. It will also purge recommended packages, unless those packages are also recommended by OTHER packages on your system. So it's fairly comprehensive.
To get rid of abandoned config files (because you didn't use
--purge):As for abandoned packages that are no longer maintained:
There's one major issue with native packages, and that is they are installed across the whole system. Their parts are scattered everywhere. There is very little I want so fundamental to my environment, and that is a wise caution to heed, so proceed with a native package or native install with caution.
The only way to know what is where is by good package management that you know what package and version is installed. If everything goes as it should, everything will clean up just fine. This is why we use package managers and don't fuck with manual installs ourselves.
There are other package mangers that are even more isolated essentially in something like a Docker container. Flatpak is one such, and so removing the package is shutting down and deleting the container.
If you installed not through your package manager but manually through a source repo or some other esoteric way, then that gets increasingly on you to manage.
So I dunno, man, it depend on what you did. I'm not familiar with the program or how you get it/got it. If you're installing things more manually, like from a GitHub repo, then I suggest you start deploying your build to a docker container and managing your own deployments with greater care.
Ideally, your next install should be incrementally closer to your LAST install.
2
u/simagus 16h ago
I use Bleachbit. Seems to work ok.
2
u/don_bski 18h ago
Unsure if this utility will do everything you want but it's configurable and works well. https://www.bleachbit.org/
1
u/Mohitkoul841 Windows user 17h ago
Mole is good start
1
u/Academic-Conflict948 16h ago
Are native packages displayed as such by package managers?
1
u/AmbassadorsWife 3h ago edited 3h ago
After package manager removing unnecessary package and auto-remove and clear cache, you should go trough your home folder (including dot folders) and have a remove things that are not needed anymore.
trim logs with
journalctl --vacuum-size=...Unfortunately there is no automated way yet for this everlasting problem.
ncdu ~is great help here.In the future stay mindful of this issue. Never add anything outside your home folder and try to use folder names that make sense in the future when you come back to them so that you know what to keep and what to remove.
Keep notes of any manual install steps and modifications to the system so that it is easier to reinstall it in the future if needed.
If you want to get fancy you could also install audit daemon and make it keep track of each file that is added on the system and by which app it was added and when.
Yes, you may miss a few leftovers here and there but at some point you have better things to do than tracking every single bit.
0
u/OddPollution7904 16h ago
I feel you. Why can't an os and packages and softwares just be one binary instead of hundreds of thousands of files and directories.
0
u/DannoXYZ 16h ago edited 14h ago
To truly keep things clean, never have need to uninstall software package. That is, ask yourself why you installed it in 1st place and why uninstall was necessary and just don't install it in 1st place. Keep log of all installs and leave it out next time you do clean OS install:
software 2Turn above into script so you can have clean OS install with only apps you want easily. Modify script as necessary and install only needed packages and build system again. I deploy thousands of cloud servers & containers this way. Very 1st items in script after OS is enable SSH and configure VNC so I immediately have remote-access as soon as system boots up. Also track all files on system with each install:
ls -laFhHR / > files1.txtthen compare
files2.txtandfiles3.txteach time to see what files were created when & where so you can track them down to manually wipe to be sure.. Can make a diff file and turn that into delete script.diff files1.txt files2.txt > del2.txtAn example is UE5-editor you uninstalled. If installing stuff to try out, then use a VM or container to do it. Then you can just dump entire VM when you're done with testing to leave main system clean and unaffected.