Linux Commands / IT Support Guides
Find the Debian package that owns a file
Use dpkg-query to find which installed Debian or Ubuntu package registered a file.
Environment and inputs: Linux · Bash-compatible shell; package and service names vary by distribution
Understand the problem
Use a Debian-based system with dpkg. Check the path you want to look up. A command name alone may refer to more than one executable.
Run the command
Run dpkg-query -S with the absolute path. The example searches for /bin/bash.
dpkg-query -S /bin/bash
Read the output
A result such as bash: /bin/bash means the installed package database registers that path under the bash package.
Choose the next step
If there is no match, check the other spelling of the path on systems where /bin points to /usr/bin. Locally installed files and some generated files may have no registered package owner.
Before making changes
Package ownership tells you which package registered the path. Check file integrity separately if you need to know whether the installed bytes have changed.