1

Programs often store config files in the home directory usually in a hidden directory, often but not limited to sub-directories of ~/.config, ~/.local or ~/.gnome

After uninstalling the programs, the config-files are still kept (which usually is preferred).

Currently I look through the hidden directories of home from time to time, try to guess where the directories belong to, and delete them, if I'm not using the program anymore. But this is time-consuming and difficult/error-prone, because sometimes it's hard to guess, which program a directory belongs to. I wonder if there is tool or method that could help me here. (Similar to Bleachbit or CCleaner on Win, but afaik they don't have this functionality).

Is there an easy way to identify and remove orphaned config-directories of uninstalled software?

1
  • What system, what installation method was used. These usually have means of removing these files completely! Dec 17, 2017 at 12:05

2 Answers 2

0

First off, create a backup before changing anything.

Sometimes the config files are installed by your package manager, whichever you use, and you can query its database, but I wouldn't rely on that. For some distributions there may be tools like findcruft (now abandoned) for Gentoo.

I think your best chance is to find and remove the files that haven't been accessed for a longer period, but this is no guarantee that the package isn't installed but inactive. Bonus points for checking the candidates against the package manager in a script.

$ find /etc -atime +7

Be aware that not all file systems support the atime feature, or it may be switched off intentionally, e. g. for SSD drives. In this case you can't use this approach. Or you'll first have to switch atime on for a decent period to gather the access data in order to make reliable decisions. Read about the relatime option first, too.

$ mount
/dev/sda3 on / type ext3 (rw,noatime,nodiratime,data=ordered)

What's left as an option is to do it manually, guessing the related package by name and content of the file, which is usually straightforward.

0

If the system is Debian based, aptitude can find packages with orphaned config (often in /etc), eg:

aptitude search ~c

and delete them with:

aptitude purge ~c

Usually the package manager does not create files in home-directories. Homedir config files are usually created at first run.
I think the best method is keeping theme tracked with tools lik Git so you can know exactly when they where created.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .