apt-file-from-installed -- create apt-file contents from installed packages


 apt-file-from-installed [--verbose] [--version]


apt-file-from-installed creates a contents file as used by apt-file, built from the currently installed packages instead of downloading. For example if your sources.list had the file might be


The contents created is not a full list of files, only what you have installed. But it's faster than downloading and it includes any packages installed locally and not through an actual private repository (important for dh-make-perl).

New contents are written first to a temporary file in /var/cache/apt/apt-file/ and only moved to the real name when complete. This is atomic so users running apt-file see the new contents file only when it's complete.

Other Notes

Currently the last sources.list entry is used as the target, and any other contents files are removed. Perhaps that should be configurable.

Only gzip -1 level compression is used for the contents file, so that it's faster to update if you do so repeatedly after installing new things. That compression level already takes the file to about 1/4 of original size.


/var/cache/apt/apt-file/ -- contents files directory.

/var/cache/apt/apt-file/*.apt-file-from-installed.* -- temporary files.

/etc/apt/apt-file.conf -- the apt-file configs (determining the contents directory and filename format)





Copyright 2009, 2010, 2011, 2014, 2015 Kevin Ryde

apt-file-from-installed is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.

apt-file-from-installed is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You can get a copy of the GNU General Public License online at