Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

On Debian systems (and derivatives):

$ dpkg --search /bin/ls
coreutils: /bin/ls

That is, the file /bin/ls belongs to the Debian package named coreutils.

But this only works if the package is installed. What if it's not?

share|improve this question

3 Answers 3

up vote 28 down vote accepted


apt-file provides the feature of searching for a package providing a binary (like Debian or Ubuntu), it is not installed by default but in the repositories.

apt-file search <path-to-file>

You may want to update once before searching...

apt-file update 

For example, let's search for the not installed binary mysqldump:

$ apt-file search /usr/bin/mysqldump

mysql-client-5.1: /usr/bin/mysqldump
mysql-client-5.1: /usr/bin/mysqldumpslow
mysql-cluster-client-5.1: /usr/bin/mysqldump
mysql-cluster-client-5.1: /usr/bin/mysqldumpslow

It's also possible to list the contents of a (not-installed) package:

$ apt-file list mysql-client-5.1

mysql-client-5.1: /usr/bin/innochecksum
mysql-client-5.1: /usr/bin/innotop
mysql-client-5.1: /usr/bin/myisam_ftdump
mysql-client-5.1: /usr/bin/mysql_client_test


yum accepts the command whatprovides (or provides) to search for installed or not installed binaries:

yum whatprovides <path-to-file>

Again, the not installed mysqldump:

$ yum whatprovides /usr/bin/mysqldump

mysql-5.1.51-2.fc14.i686 : MySQL client programs and shared libraries
Repo        : fedora
Matched from: 
Filename    : /usr/bin/mysqldump

mysql-5.1.51-1.fc14.i686 : MySQL client programs and shared libraries
Repo        : fedora
Matched from: 
Filename    : /usr/bin/mysqldump


'szypper does include the command what-provides and concerning the manual, this should also search through the contents of not installed packages. Apparently, it does not work like intended. There is a request for this feature.

Webpin provides a webbased solution, there is even a script for the command-line.


Available as pkgtools for pacman based systems. Provides a similar search feature like the others above:

$ pkgfile -si /usr/bin/mysqldump

Name      : mysql-clients
Version   : 5.1.54-1
Url       : http://www.mysql.com/
License   : GPL
Depends   : libmysqlclient
share|improve this answer
I don't think you needed to generalise this, especially because I specifically was asking about Debian, and there already is the yum anwer. –  Tshepang Jan 23 '11 at 12:05
I can see Debian in your example, but not in the question you've asked. –  wag Jan 23 '11 at 12:10
I tagged the question Debian. –  Tshepang Jan 23 '11 at 14:51
A tag is not a strong indicator concerning the requested answer, a question is. You can't expect the people to figure out a matching answer by reading a tag. –  wag Jan 23 '11 at 15:06
In other words, if you want the question to be Debian-specific, please re-word it accordingly. –  jmtd Jan 24 '11 at 13:40

The standard tool for this is apt-file. Run apt-file update to download the index file. Here's the output:

Downloading complete file ftp://ftp.is.co.za/debian/dists/squeeze/Contents-i386.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 16.6M  100 16.6M    0     0  33191      0  0:08:47  0:08:47 --:--:-- 38951

After that, run apt-file search search_term.

share|improve this answer

If you don't have access to the machine or can't use the commands given in the previous answers, you can also find this out using the Debian package web-based search engine (the second form, "Search the contents of packages").

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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