Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm looking for a utility similar to apt-file that allows me to search the contents of source packages for certain files, rather than just binary packages.

Is such a utility available for Ubuntu?

share|improve this question
OP are you still looking for an answer? If so, you may need to repost your question as this is flagged for closure. Regards, – Ringtail Mar 27 '12 at 20:21

apt-file is a simple wrapper for downloading the Contents-<ARCH>.gz files from a given Debian repository, then unpackaging and greping through them. Contents files are generated server-side (with great computional intensity) by merging the paths of all deb packages in the archive.

The specification for Debian repositories has no location reserved for a summary of all source package paths, and no implementation (apt-ftparchive and Launchpad's homebrewed method) has any facility for generating one.

If you really, really want this functionality, you could easily compile it yourself. Make this script, make it executable, and run it. It will take forever and eight days, but its output will be equivalent to a Source-Contents file.


for PKGNAME in $(apt-cache pkgnames); do
    apt-get source $PKGNAME >> log
    for LINE in $(find $PKGNAME-*); do
        echo "$LINE $PKGNAME"
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.