How to find which package can be installed for a file, like “yum provides”?

Posted on In QA

How to find which package can be installed for a file, like “yum provides”?

That is, the package is not installed yet and I do not know the package for a file that I want.

The apt-file tool can do the similar things as yum provides.

You may need to install it first by sudo aptitude install apt-file and update its database by sudo apt-file update.

Then, to find which package can provide a file like ghci:

$ sudo apt-file search ghci
ghc: /usr/bin/ghci
ghc: /usr/bin/ghci-7.6.3
ghc: /usr/lib/ghc/bin/ghci
ghc: /usr/lib/ghc/bin/ghci-7.6.3
ghc: /usr/lib/ghc/ghci-usage.txt
ghc: /usr/share/man/man1/ghci-7.6.3.1.gz
ghc: /usr/share/man/man1/ghci.1.gz
ghc-doc: /usr/share/doc/ghc-doc/html/users_guide/ghci-commands.html
ghc-doc: /usr/share/doc/ghc-doc/html/users_guide/ghci-compiled.html
ghc-doc: /usr/share/doc/ghc-doc/html/users_guide/ghci-cygwin.html
ghc-doc: /usr/share/doc/ghc-doc/html/users_guide/ghci-debugger.html
ghc-doc: /usr/share/doc/ghc-doc/html/users_guide/ghci-dot-files.html
ghc-doc: /usr/share/doc/ghc-doc/html/users_guide/ghci-faq.html
ghc-doc: /usr/share/doc/ghc-doc/html/users_guide/ghci-invocation.html
ghc-doc: /usr/share/doc/ghc-doc/html/users_guide/ghci-obj.html
ghc-doc: /usr/share/doc/ghc-doc/html/users_guide/ghci-set.html
ghc-doc: /usr/share/doc/ghc-doc/html/users_guide/ghci-windows.html
ghc-doc: /usr/share/doc/ghc-doc/html/users_guide/ghci.html
happy: /usr/share/doc/happy/html/sec-happy-ghci.html
hlint: /usr/share/hlint/hlint.ghci
makehuman-data: /usr/share/makehuman/data/targets/measure/measure-thighcirc-decrease.target
makehuman-data: /usr/share/makehuman/data/targets/measure/measure-thighcirc-increase.target
xemacs21-basesupport: /usr/share/xemacs21/xemacs-packages/lisp/haskell-mode/haskell-ghci.elc
xemacs21-basesupport-el: /usr/share/xemacs21/xemacs-packages/lisp/haskell-mode/haskell-ghci.el.gz

Check the apt-file manual for more details.

Eric Ma

Eric is a systems guy. Eric is interested in building high-performance and scalable distributed systems and related technologies. The views or opinions expressed here are solely Eric's own and do not necessarily represent those of any third parties.

Leave a Reply

Your email address will not be published. Required fields are marked *