I was poking around my ~/.config and noticed several dirs and files that seem to correspond to packages I no longer have installed; running sudo dnf autoremove does not remove them, so I was wondering if I’m missing a program or script from Fedora I can run to automatically check the system for those packages and, if they’re not present, remove those dirs and files.
In general, you don’t want system level management messing with user files. Those user config files are usually small, so the main risk is that some previous config conflicts with a newer version of the application, and if future developments require reinstalling the app, you may be glad that your configuration tweaks were preserved. I would consider a conflict with a previous configuration poor design by the app developer. What could be a space problem after removing an app is caches.
FWIW, Flatpak’s naming convention and sandboxing approach allows for removal of config dirs at uninstall time, with the --delete-data flag. That is not an option with DNF, obviously.
Thanks for those ideas, folks… I’m not really worried about space, per se, but I like to keep a tidy install and those unnecessary files just irk me. I can just go bit-by-bit, but I was hoping for a more automated solution.
I’m not aware of a way to automatically remove unused config files. But, once you get it cleaned up, you could use a tool like chezmoi to backup and help manage your dotfiles. I use it to sync my config files across multiple computers that I need.
I bring this up because you selectively add the specific config files that you want. This might be a way to determine in the future whether or not you care about a specific dotfile.
The issue with removing config files from user’s homes is that there is not really a good way to do it safely. Even if an RPM contained a list of all files the program places in a user’s home and DNF would remove it, how do you go about doing that on a system with more than one user? I would be mad if I had spent a significant amount of time to configure something and then my custom config is removed when root removes the RPM from the system. (Granted, most of my system have very few users and usually I am root, but just to illustrate the issues.)
That’s a really good point I hadn’t considered. I suppose because I’ve only ever been the single user on my devices, I don’t often think about other users.