Linux Commands / IT Support Guides
Find the Debian package that owns a file
A configuration or executable may belong to a managed package rather than a manually installed tool. Identify its owner before reinstalling or replacing it.
Environment and inputs: Linux · Bash-compatible shell; package and service names vary by distribution
Try the diagnostic command
Use the stated shell and platform. Replace sample domains, addresses, services and paths with values from the system you are authorized to support.
dpkg-query -S /bin/bash
How to read the result
On Debian-family systems, this searches installed-package file records for the supplied path. A no-match result can mean the path spelling differs or the file is unmanaged.
What to do next
Use the exact affected path and account for merged /usr layouts or symlinks. Inspect the matched package version and repository before planning a repair.
Before you make a change
This command is for dpkg-based distributions. A package match describes ownership records, not a cryptographic integrity check of the current file.