How can I find out, which package usually creates a specific file (or folder) in the ~/.config folder?

This is important, for developers and distributors, who do not want that two packages write to the same configuration in the users home.

And it is also important for the interested user, who analyzes configuration files (search for obsolete large files, or files with plain text credentials...).

So far I do not know a package manager, which gets this meta information from the packages. I expect this is not distribution specific. I am interested in this for all major Linux flavors, but especially Debian based distributions and Gentoo.

Does an independent online database exist, where one can look up who wrote which file?

Does an organization exist where programs can register their configuration files in home?

  • Debian you can check any file with dpkg -S file – Rui F Ribeiro Jan 5 '18 at 22:57
  • not distribution specific, but application specific. generally a ~/.config/foo folder was made by application foo, but nothing forces application bar to do it that way. dpkg and other package managers generally can't tell you this because they don't install files under $HOME. (though some application packages may install a skeleton or example file of the same name, eg under /usr/share.) – quixotic Jan 5 '18 at 23:01
  • 1
    @RuiFRibeiro No, dpkg -S can only show files which were created during installation. – Jonas Stein Jan 5 '18 at 23:02
  • I would be that 90% of the time you can tell by what the file/directory name is. On my well used and often upgraded Mint system (started at 17.2, now on 18.1, dist-upgrading the whole way) I've just checked my ~/.config - of the 84 file/directories, and only two don't list specific app/library/corporation names – ivanivan Jan 6 '18 at 0:09

Unless you're doing something unusual like installing packages directly in your home directory (e.g. with Gentoo Prefix), files in ~/.config will not have been put there by the package manager. Most if not all package managers completely ignore the contents of individual users' home directories. So you won't be able to get information about these user-specific config files from the package manager.

Furthermore, I don't know of any widely-accepted database or registry or anything else that contains information about files in ~/.config. There's a widespread convention that the name of the file or directory should reference the name of the program that created it in some way, but this is a rather vague guideline, and it's not enforced.

If you just want to find out which application is responsible for creating a file, if you can't tell from the name, I don't have much to add to thrig's answer. You'll probably just have to find some way to get a program to access it.

  • This is a much better answer, .conf files, . files in $HOME aren't created by the installation, they are created by the application in most cases. I also don't believe there's a real issue here, since almost all config files have the application name, or some variant of it, so there's little grounds for the concerns the OP raised, and that's also why no such db exists, there's no problem that it would solve that's worth spending the fruitless effort it would take to make one that applied only to today, and not even for sure to tomorrow, since this stuff is always changing in small ways. – Lizardx Jan 6 '18 at 0:17

The package system may have some means to indicate what files belong to what packages,

dpkg -S file

rpm -qf file

though this will not help if the package system lacks such a tool, or if the file is not registered with the package system and is instead, say, autogenerated during the install or launch of the program. Hindsight in such a case may be tricky. With something like sysdig (or SystemTap) installed you could monitor the file for activity and see what processes touch it and from those processes probably work back to what package that activity belongs to:

sysdig "fd.name contains file"

and let that run whilst packages are installed (or programs started). Getting this running early in an install process may be tricky...

  • I had a look at sysdig and think this could be a good tool to create a database with the power of the crowd if there is none yet. – Jonas Stein Jan 5 '18 at 23:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.