Find Which Package owns a File in Linux
Sometimes it is necessary to find out which package is responsible for a particular file on a Linux machine. This article explains how to identify the package that owns a file on Ubuntu or Fedora Linux (it applies to any distribution using deb or RPM, so it will also work in Debian, RedHat, etc…)
To identify the package that owns a file in Ubuntu or other deb-based distributions, you want to use the dpkg-query command with the -S option, in the form: dpkg-query -S /path/to/file
So, for example, if you wanted to find the owner of /usr/bin/gst-feedback-0.10, your terminal should appear as:
gstreamer0.10-tools: /usr/bin/gst-feedback-0.10
jdeprizi@orion:~$
Similarly, you can find the RPM that owns or installed a file in Fedora or RedHat with the rpm -qf command. Here is an example:
gstreamer-0.10.29-1.fc13.i686
[jdeprizi@pioneer ~]$
For either of these commands to work, the package owning the file must be installed. This is necessary because the ownership needs to be registered with the package manager.
Like this post?
- Subscribe to the RSS feed to get more like it!
- Share it:
- Leave a comment!




PiSi-based Distributions: Pardus…
Similarly, Pardus has a search-file command with file-name parameter is used in order to find which package does a file belong to.
$ pisi sf -q /usr/bin/gst-feedback-0.10
Package gstreamer has file /usr/bin/gst-feedback-0.10
$
In Slackware, it’s pretty simple as well -
$ grep usr/bin/gst-feedback-0.10 /usr/bin/gst-feedback-0.10 /var/log/packages/*
/var/log/packages/gstreamer-0.10.29-x86_64-1:usr/bin/gst-feedback-0.10
$
On a system using yum, such as fedora, you can use repoquery in the same manner as rpm — the only difference is now the package doesn’t need to be isntalled, just available in one of the repositories.