Apt File

Sometimes you need to know if a certain file is in a deb package. The easiest way is to use the web frontend for the repositories like debain packages.

Another way is to use a tool called apt-file.

With this cli tool you can search files for installed and remote packaes.

First install the package:

1$ apt-get install apt-file

Update the index:

1$ apt-file update

And search for a certain file:

 1    $ apt-file find nginx.conf
 2    cardstories: /usr/share/cardstories/conf/nginx.conf
 3    fcgiwrap: /usr/share/doc/fcgiwrap/examples/nginx.conf
 4    gunicorn: /usr/share/doc/gunicorn/examples/nginx.conf.gz
 5    munin: /usr/share/doc/munin/examples/nginx/munin.nginx.conf
 6    nginx-common: /etc/nginx/nginx.conf
 7    nginx-doc: /usr/share/doc/nginx-doc/examples/nginx.conf
 8    pcp: /var/lib/pcp/pmdas/nginx/nginx.conf
 9    python-cyclone: /usr/share/doc/python-cyclone/examples/helloworld/nginx.conf
10    thin: /usr/share/doc/thin/examples/myapp.nginx.conf
11    unicorn: /usr/share/doc/unicorn/examples/nginx.conf.gz
12    zabbix-frontend-php: /usr/share/doc/zabbix-frontend-php/examples/nginx.conf

This output shows a list of all packages that contain the file nginx.conf and where it is placed in the filesystem.