How to Match Files to Packages

author: Nathan Acks
date: 2022-07-10

Debian

# List all installed packages
#
dpkg-query -l

# List files in an installed package
#
dpkg-query -L $PACKAGE_NAME

# List the package that owns a particular file
#
dpkg-query -S $FULL_PATH_TO_FILE

Red Hat

# List all installed packages
#
rpm -qa

# List files in an installed package
#
rpm -ql $PACKAGE_NAME

# List the package that owns a particular file
#
rpm -qf $FULL_PATH_TO_FILE