[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: get package name from file name



On Thu, Jul 07, 2011 at 10:22 +0100, Joao Ferreira Gmail wrote:
> how can I tell which package installs a given file ?
> something like:
> 
> # find-package-from-file /usr/lib/libxml2.so.2
> libxml2

As always there are multiple to do this :)

    * dpkg -S /path/to/file
    * apt-file search /path/to/file
    * dlocate -S /path/to/file

I prefer to use either apt-file or dlocate. The former comes in quite handy as
it also works for packages that are not installed and it supports regular
expressions. If you are looking for an executable, but don't know the full
path you can search for:

    $ apt-file search -x "bin/foo$"

which will find all files named "foo" that are in a bin/ directory somewhere.
In particular this will not match "bin/foobar". dlocate on the other hand is a
bit faster than "dpkg -S" and has other goodies too ... have a look.

have fun
-- 
  .''`.     Wolodja Wentland    <babilen@gmail.com>
 : :'  :
 `. `'`     4096R/CAF14EFC
   `-       081C B7CD FF04 2BA9 94EA  36B2 8B7F 7D30 CAF1 4EFC

Attachment: signature.asc
Description: Digital signature


Reply to: