Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

2 Answers 2

up vote 4 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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.