26.10.07

Debian: HOWTO find a package containing a certain file

Debian: HOWTO find a package containing a certain file

(this example works on Debian-based systems too):

# apt-file update && apt-file search /usr/share/doc/rails/README.railties
rails: usr/share/doc/rails/README.railties
#


This example was me searching a package containing /usr/share/doc/rails/README.railties file. The result tells that rails is the package.

4 comments:

Bruno Rodrigues said...

Well.. if the file is inside /usr/share/doc/[package name]/*, you know already that the package name is called [package name]. ;)

The real power of apt-file is that you can simply search for the file, without the folder part, like:

$ apt-file search README.railties
rails: usr/share/doc/rails/README.railties

Bruno Miguel said...

Didn't know this one. I had to install apt-file in Debian Lenny GNU/Linux, and know I'm waiting for it to "apt-file update".
It might come in hand :)

Manuel Padilha said...

If the file you're looking for belongs to a package that is installed, you can also use dpkg directly:

$ dpkg -S /etc/crontab
cron: /etc/crontab

Mind Booster Noori said...

b.r.: Oops, my mistake... That was exactly the example I wanted to give :-P Thanks...

Manuel: Yes, I just posted this one 'cause many people ask me how to do it with non-installed packages... But thanks anyway :-)

Post a Comment