Find File Owners and Package Contents with dpkg -S / -L

dpkg -S tells you which installed package a file came from; dpkg -L lists everything a package put on disk.

LinuxpackagesdebiandpkgLow risk
Run `dpkg -S /path/to/file` to find the owning package, and `dpkg -L packagename` to list its files.

01Command

Command
$ dpkg -S /usr/bin/curl && dpkg -L curl

02What it does

Use `dpkg -S curl` for a fuzzy search by name fragment, but the full-path form is precise. dpkg only knows about files from .deb packages — anything pip-installed, compiled, or dropped in /usr/local returns 'no path found'. On Fedora/RHEL the equivalents are `rpm -qf /path/to/file` and `rpm -ql package`.

03Risk

RiskLow risk
RequirementsDebian/Ubuntu; on Fedora/RHEL use `rpm -qf <file>` and `rpm -ql <pkg>`

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

  • dpkg(1) - Linux manual page
    Ubuntu Manpages · technical · 2026-09-17
    Evidence: dpkg -S (or --search) finds the package that owns a file, and dpkg -L (or --listfiles) lists the files installed by a package.

Last verified: 2026-09-17 · Category: System & Settings

06Related solutions