Generally I am interested in finding Debian packages, not in the specific files contained within the packages.
A while back I was interested in knowing which package provided a particular file on the computer – discovering what package a file comes from. The file was corrupted and I wished t ore-install it.
As an example consider finding from which package the file /bin/ls is derived.
Using apt this is found as follows:
apt-file search /bin/ls
However, running the command I was getting the error bash: apt-file: command not found
I found that in order to be able to use the command the package apt-file was required. This can readily be installed using apt-get install apt-file.
Again an error message was encountered:
E: The cache is empty. You need to run ‘apt-file update’ first.
Running this command, part of the response is given below:
Downloading complete file http://mirror.ox.ac.uk/debian/dists/testing/main/Contents-amd64.gz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 23.5M 100 23.5M 0 0 2073k 0 0:00:11 0:00:11 --:--:-- 2260k
Trying once more with the search command I received the following output:
9base: /usr/lib/plan9/bin/ls arb: /usr/lib/arb/bin/lsadt bilibop-rules: /bin/lsbilibop canna-utils: /usr/bin/lsdic cgroup-bin: /usr/bin/lscgroup cgroup-bin: /usr/bin/lssubsys cgroup-tools: /usr/bin/lscgroup cgroup-tools: /usr/bin/lssubsys cmtk: /usr/lib/cmtk/bin/lsba coreutils: /bin/ls ... ...
It is also possible to derive the information using dpkg. The command
dpkg -S ls
giving the answer
eog: /usr/share/help/ru/eog/plugin-fullscreen-background.page linux-headers-3.10-3-amd64: /usr/src/linux-headers-3.10-3-amd64/include/config/nls/codepage/950.h kmail: /usr/share/kde4/services/kcmkmailsummary.desktop kopete: /usr/share/kde4/apps/kopete/icons/crystalsvg/32x32 libruby1.9.1: /usr/lib/ruby/1.9.1/rake/file_utils.rb kdoctools: /usr/share/kde4/apps/ksgmltools2/customization/en/entities/underX11License.docbook gnucash-docs: /usr/share/gnome/help/gnucash/ja_JP/figures/invest_sellstock2.png eog: /usr/share/help/sv/eog/plugin-fullscreen-double-click.page apache2-utils: /usr/share/doc/apache2-utils/changelog.Debian.gz ... ...


