How to Find Out Which Package You Need If You Are Missing a File in CentOS

By | March 23, 2018

Very often when you try co compile anything from sources, you are getting error messages about any files, that are not found , but they are needed to continue with your software setup. How to determine, which package you need to install in order to resolve this dependency?

Pretty simple – there is one command that will help you to find the right package.

# yum whatprovides [file_name]

Here is an example:

[root@server ~]# yum whatprovides /bin/ls
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile

coreutils-8.4-46.el6.x86_64 : A set of basic GNU tools commonly used in shell
                            : scripts
Repo        : base
Matched from:
Filename    : /bin/ls



coreutils-8.4-46.el6.x86_64 : A set of basic GNU tools commonly used in shell
                            : scripts
Repo        : installed
Matched from:
Other       : Provides-match: /bin/ls

This way you can find any package or file that is missing. Searching for a file is similar.

[root@server ~]# yum whatprovides /*stropts.h

1:compat-glibc-headers-2.5-46.2.x86_64 : Header files for development using
                                       : standard C libraries.
Repo        : base
Matched from:
Filename    : /usr/lib/x86_64-redhat-linux5E/include/stropts.h
Filename    : /usr/lib/x86_64-redhat-linux5E/include/bits/stropts.h
Filename    : /usr/lib/x86_64-redhat-linux5E/include/sys/stropts.h

Leave a Reply