← Back to home

apt-file: Finding the Package That Owns Your Missing Lust Object

June 14, 2026

Every Debian devotee eventually suffers the same deliciously frustrating mystery: a build cries out for a header file, a shell script wants a binary, or a late-night dependency fling leaves behind a missing command and a very sad terminal prompt. You know the file exists somewhere in the archive. You just don't know which package is hiding it like a secret lover with excellent packaging discipline.

That is where apt-file saunters in, all velvet gloves and laser focus. It does not install packages. It does not judge your life choices. It simply searches the package contents index and tells you which Debian package contains the file you want. In the grand cathedral of package management, apt-file is the librarian with a leather harness and a perfect filing system.

If apt-cache search is how you look for a package by name, apt-file is how you look for the thing inside the package. That tiny distinction is pure Debian magic: precise, practical, and just kinky enough to make dependency resolution feel like foreplay.

Examples

1. Install the tool and refresh its contents index:

sudo apt install apt-file && sudo apt-file update

apt-file needs its package contents cache before it can search properly. This pair of commands gets the tool installed and teaches it to read the archive like a very eager little archivist.

2. Find which package ships a specific file:

apt-file search bin/htop

This asks Debian which package provides a path matching bin/htop. If you know the file you need but not the package name, this is the cleanest way to make the archive confess.

3. Search for a header file when building software:

apt-file search openssl/ssl.h

Compiler tantrums become much easier to manage when you can map a missing include file back to the package that owns it. The result usually points you toward a -dev package, which is exactly the kind of mature relationship Debian encourages.

4. Narrow the search to exact path matches:

apt-file search --regexp '/usr/bin/faketime$'

The --regexp flag lets you be more specific when the filename is common or the archive is feeling especially generous. Add a little precision, and apt-file will stop being coy and show you the exact package.

5. Inspect every file provided by a package:

apt-file list jq

Sometimes the craving goes the other direction: you already know the package and want to see what it brings to the party. apt-file list shows the package's contents like a very organized striptease.

Why it feels so Debian

apt-file is not flashy. It doesn't install the software, it doesn't decorate the system, and it doesn't try to win you over with a glossy interface. It simply answers the question that matters: "Which package contains this file?" That kind of clarity is deeply, shamelessly Debian.

In a world full of guesswork, apt-file offers certainty. You ask for the missing object, it points to the package, and suddenly the dependency dance has a rhythm again. That is the Debian fetish in its purest form: less mystery, more control, and a dangerously satisfying amount of package-level truth.