Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

For example I can easily find locate command belongs to mlocate.i386 package.

yum search locate
mlocate.i386 : An utility for finding files by name
[mirror@home /]$ rpm -qa | grep locate
mlocate-0.15-1.el5.1

yum search updatedb
Loaded plugins: fastestmirror, protectbase
0 packages excluded due to repository protections
=========================================== Matched: updatedb ===========================================
mlocate.i386 : An utility for finding files by name

But it's not so easy to find which package free command belongs to:

yum search free   // this command just returns too much informationy 
rpm -qa | grep free
freetype-2.2.1-31.el5_8.1   // obviously not the package by which free command is installed

So is there any convinent way to know which package a specific command belongs to on Linux? For example CentOS or some other distributions

share|improve this question
up vote 5 down vote accepted

Query the rpmdb.

rpm -qf $(which free)
share|improve this answer
    
why not use rpm -qf which free? – hugemeow Sep 1 '12 at 9:35
    
Either is fine. $(...) is habit for me. – Ignacio Vazquez-Abrams Sep 1 '12 at 12:20

Ubuntu / Debian:

dpkg -S $(which free)
share|improve this answer

For CentOS, how about yum provides?

Use

which free 

to find out where it is

For me it's at

/usr/bin/free

So then you can run

yum provides /usr/bin/free

and it will tell you which package has it

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .