On Fedora or CentOS, on way to find out what package providing a file we can use yum whatprovides [FILENAME] or dnf whatprovides [FILENAME] on a DNF-aware system.

# dnf whatprovides tmux
Last metadata expiration check: 2:33:06 ago on Wed 09 Sep 2020 09:45:07 PM AEST.
tmux-3.0a-2.fc32.x86_64 : A terminal multiplexer
Repo        : @System
Matched from:
Provide    : tmux = 3.0a-2.fc32

tmux-3.0a-2.fc32.x86_64 : A terminal multiplexer
Repo        : fedora
Matched from:
Provide    : tmux = 3.0a-2.fc32

I really need this similar tool on Gentoo, and it looks like the emerge command doesn’t have this function built it. Fortunately, there is a utility called e-file (provided by pfl package) which kinda provides this whatprovides option as in yum and dnf.

So let’s check for this pfl package using another of my favorite tools eix.

# eix app-portage/pfl
* app-portage/pfl
     Available versions:  3.1 {+network-cron PYTHON_TARGETS="python3_6 python3_7 python3_8"}
     Homepage:            http://www.portagefilelist.de https://github.com/portagefilelist/client
     Description:         Searchable online file/package database for Gentoo

We’re now ready to install it.

# emerge -av app-portage/pfl

After it’s done, you don’t have to update the database (in case of eix, we have to run sudo eix update); we can start using e-file command. Here is an example to find out what package provides tree command.

# e-file tree
 *  games-server/crossfire-server
        Available Versions:     1.71.0-r1
        Homepage:               http://crossfire.real-time.com/
        Description:            Server for the crossfire clients
        Matched Files:          /usr/share/crossfire/maps/styles/exitstyles/generic/tree;

 *  sci-physics/geant
        Available Versions:     4.10.6_p1 4.10.6_p1-r1 4.10.6_p2
        Homepage:               https://geant4.web.cern.ch/
        Description:            Toolkit for simulation of passage of particles through matter
        Matched Files:          /usr/src/debug/sci-physics/geant-4.10.6_p2/geant4.10.06.p02/source/analysis/g4tools/include/tools/xml/tree; /usr/src/debug/sci-physics/geant-4.10.6_p2/geant4.10.06.p02/source/analysis/g4tools/include/tools/wroot/tree; /usr/src/debug/sci-physics/geant-4.10.6_p2/geant4.10.06.p02/source/analysis/g4tools/include/tools/rroot/tree; /usr/src/debug/sci-physics/geant-4.10.6_p1-r1/geant4.10.06.p01/source/analysis/g4tools/include/tools/xml/tree; /usr/src/debug/sci-physics/geant-4.10.6_p1-r1/geant4.10.06.p01/source/analysis/g4tools/include/tools/wroot/tree; /usr/src/debug/sci-physics/geant-4.10.6_p1-r1/geant4.10.06.p01/source/analysis/g4tools/include/tools/rroot/tree; /usr/include/Geant4/tools/xml/tree; /usr/include/Geant4/tools/wroot/tree; /usr/include/Geant4/tools/rroot/tree;

 *  app-shells/yash
        Available Versions:     2.49 2.50
        Homepage:               https://yash.osdn.jp/
        Description:            Yash is a POSIX-compliant command line shell
        Matched Files:          /usr/share/yash/completion/tree;

 *  app-text/tree
        Available Versions:     1.6.0-r1 1.7.0 1.8.0
        Homepage:               http://mama.indstate.edu/users/ice/tree/
        Description:            Lists directories recursively, and produces an indented listing of files
        Matched Files:          /usr/share/bash-completion/completions/tree; /usr/share/bash-completion/tree; /usr/bin/tree;

And of course the package app-text/tree provides the /usr/bin/tree.

Reference: