18

Is there a way to search a package using the binary name.

for example I want to find rpm package for command "ls" then it should be coreutils-6.9-10.4.i586 for example.

deimus
  • 293
  • 1
  • 2
  • 7

5 Answers5

23

The yum command "whatprovides" accepts wildcards. If you're searching for the package that provides as certain file or executable and do not know its full path, use "yum whatprovides */filename".

$ yum whatprovides */ls

coreutils-5.97-23.el5_4.2.x86_64 : The GNU core utilities: a set of tools
                                 : commonly used in shell scripts
Repo        : installed
Matched from:
Filename    : /bin/ls
John Simpson
  • 354
  • 1
  • 3
4
yum provides /bin/ls
repoquery -f /bin/ls

...will both dtrt. Also recent versions of "yum" will automatically do a number of file lookups if you do:

yum provides ls
James Antill
  • 676
  • 6
  • 4
1

It seems, scout bin ls does that. This tool can index various type of repos (not only rpm, but java, etc) and find out what you need to install to get the required binary/command/javaclass/feature. It is well integrated with suse.

You can read more on scout here.

peterh
  • 2,553
  • 10
  • 31
  • 49
deimus
  • 293
  • 1
  • 2
  • 7
  • _Here_ is the solution. Don't forget: we are search for _not_ _yet_ _installed_ binaries! So, every other answer got a downvote. – peterh Sep 28 '14 at 16:09
0

Alternatively, use dnf whatprovides $(which <prog>) in a one-liner, where is the binary / script / whatever you want to look up.

-1

The 'rpm -qf' command should tell you which package owns any installed file.

> whereis ls
ls: /bin/ls /usr/share/man/man1/ls.1.gz /usr/share/man/man1p/ls.1p.g

> rpm -qf /bin/ls
coreutils-5.97-23.el5_6.4
pwan
  • 119
  • 4
  • 1
    suppose I dont have the package installed ... how can I get the package name knowing only the binary name ? –  Sep 27 '11 at 06:50