Which package provides xxd? Could not figure it out

Hello all.

Happy new year!

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
1 Like

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.

Hum!
Why isn’t it documented that way? I found it as

repoquery --whatprovides

Did I look at the wrong documentation or is it not updated?

The dnf whatprovides and prov sub-commands are undocumented aliases for the provides sub-command.

dnf source code at github.com

The provides sub-command is documented here:

https://dnf.readthedocs.io/en/latest/command_ref.html#provides-command-label

The dnf repoquery --whatprovides ... command lets you be more specific.

Example 1: list packages that provide the ‘webserver’ capability, showing only the latest version of each:

$ sudo dnf repoquery --whatprovides webserver --latest-limit=1
caddy-0:1.0.3-1.fc30.x86_64
cherokee-0:1.2.104-12.fc30.i686
cherokee-0:1.2.104-12.fc30.x86_64
httpd-0:2.4.41-6.1.fc30.x86_64
lighttpd-0:1.4.54-1.fc30.x86_64
nginx-1:1.16.1-1.fc30.x86_64

Example 2: same but limit to i686 packages:

$ sudo dnf repoquery --whatprovides webserver --arch=i686 --latest-limit=1 
cherokee-0:1.2.104-12.fc30.i686

Example 3: list the webservers that I have installed

$ sudo dnf repoquery --whatprovides webserver --installed
httpd-0:2.4.41-6.1.fc30.x86_64

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:

$ sudo dnf repoquery --whatprovides '*/xxd' --latest-limit=1
vim-common-2:8.2.109-1.fc30.x86_64

Robin

1 Like