For the sake of completeness, here'sHere's how to do this for the most common package managers (slightly adapted from here):
Debian and its derivatives
Installed packages:
dpkg -S /path/to/fileor
dlocate /path/to/fileAll available packages
Install
apt-fileand build its database:sudo apt-get install apt-file && apt-file updateThen, search for all packages available in the distribution's repositories (installed or not) that provide the file of interest:
apt-file search /path/to/file
Red Hat/Fedora
Installed packages:
rpm -qf /path/to/fileAll available packages:
yum whatprovides
SUSE/openSUSE, all other RPM-based distributions
rpm -qf /path/to/fileArch
pacman -Qo /path/to/fileGentoo
equery belongs /path/to/file