Sunday, March 13, 2022

[SOLVED] How to find packages containing a specific file?

Issue

I want to find out which packages (if any) contain a specific file name. For instance, I'm trying to compile 32-bit programs in a 64-bit machine and GCC complains about a missing file "gnu/stubs-32.h". How can I quickly find which package I should install?


Solution

If using a Debian-based distribution, you can use apt-file:

apt-file search path/to/filename (but for it to work, you must first populate the database, running apt-file update as root)

If using an RPM-based distribution (Red Hat, Fedora, etc), there is the equivalent yum provides: yum provides path/to/filename, which supports wildcards (for instance: yum provides \*/gnu/stubs-32.h).



Answered By - anol
Answer Checked By - David Goodson (WPSolving Volunteer)