I was working and reading the documentation of a FastSitePHP and there xxd is used there to generate hex strings. There is said that xxd is not installed by default on RH distros, but is installed on my Fedora 31. I don’t know why and how.
I search for a package that could contain xxd with DNF and RPM, looked for it on the list for Fedora 29, 30 and 31, and found nothing. There is no man page for it just --help.
Now I know that it is part of vim-common because I tried to run it from a new install and then DNF showed that info.
How can I look at packages contents with DNF (or RPM) looking for a program like in this situation?
You can use dnf whatprovides A-BINARY to find out what package contains it:
$ dnf whatprovides xxd
vim-common-2:8.1.2102-1.fc31.x86_64 : The common files needed by any version of the VIM editor
Repo : fedora
Matched from:
Filename : /usr/bin/xxd
vim-common-2:8.1.2352-1.fc31.x86_64 : The common files needed by any version of the VIM editor
Repo : updates
Matched from:
Filename : /usr/bin/xxd
vim-common-2:8.2.019-1.fc31.x86_64 : The common files needed by any version of the VIM editor
Repo : @System
Matched from:
Filename : /usr/bin/xxd
Oh!
Thank you very much. How dumb of me.
I solved that by typing xxd into another Fedora system’s terminal, and discovered that was vim-common because dnf gave me a message with the info, but that is the correct way.
Example 4: pattern matching and searching on files
I didn’t see this documented, but dnf repoquery --whatprovides also allows searching on the absolute path of package files. And the fact that you can use shell-style pattern matching (works both on provided capabilities and file paths) comes in handy in this case: