- Find the package providing a file or command
- List all files in a package
- Filter package file listings
These examples assume a DNF-based distribution (Fedora, RHEL, CentOS Stream). On older systems using
yum, substitute yum provides and yum repoquery.Table of Common DNF Queries
1. Find Which Package Owns a File
Suppose you’ve modified/etc/anacrontab and want to revert it to the distribution’s original version. Use:
cronie-anacron as the provider. To restore:
/etc/anacrontab is back in place.
Removing system files can affect service behavior. Always backup configurations before deletion.
2. Discover Which Package Supplies a Command
Want thedocker CLI but unsure which package includes it? Run:
podman-docker emulates the Docker CLI, so install it to use docker.
3. List All Files in a Package
To inspect every file a package ships—even if it isn’t installed locally—use:4. Filter the File Listing
Narrow down to specific file types (e.g., configuration files) by piping togrep: