Product SiteDocumentation Site

6.4. L'ordre apt-file

Sometimes we refer to a file or a command and you might wonder, in which package it will be found. Fortunately the Debian repositories not only contain information about all the binary packages provided, but also all the files shipped with them. This information is stored in files named Contents-arch.gz and Contents-udeb-arch.gz. This information is not automatically downloaded by APT after installation. Instead it needs the apt-file update command (from the similar named package) to initially retrieve the contents of all package sources mentioned in /etc/apt/sources.list. By default it downloads Contents*.pdiff files as described in sidebar SUGGERIMENT Actualitzacions incrementals to reduce the amount of data necessary to be downloaded. To update the database on a weekly base, the following entry can be added to /etc/crontab if convenient. After installing apt-file, every apt-get update will also retrieve and update the Contents files.
@weekly root test -x /usr/bin/apt-file && /usr/bin/apt-file update >> /dev/null 2>&1
Després d'actualitzar la base de dades, la comanda apt-file search patró-de-cerca llistarà tots els paquets que tinguin un nom de fitxer o un camí amb el patró donat.
$ apt-file search bin/axi-cache
apt-xapian-index: /usr/bin/axi-cache
L'ordre apt-file list paquet llistarà tots els fitxers continguts al paquet.