Debian

How to match files to packages in Debian-based operating systems

# 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
Link to original

Red Hat

How to match files to packages in Red Hat-based operating systems

# 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
Link to original