How to find which package certain command belongs to on CentOS?











up vote
15
down vote

favorite
6












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
    15
    down vote

    favorite
    6












    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
      15
      down vote

      favorite
      6









      up vote
      15
      down vote

      favorite
      6






      6





      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















      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







      linux command-line centos package-management






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Aug 28 '12 at 6:07









      Sathya

      52.5k29153252




      52.5k29153252










      asked Aug 28 '12 at 2:19









      hugemeow

      85771933




      85771933






















          4 Answers
          4






          active

          oldest

          votes

















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


















          up vote
          20
          down vote













          Ubuntu / Debian example to check the package of the free command:



          dpkg -S $(which free)





          share|improve this answer























          • this works only for installed packages. i found here something that works for non installed packages $ dpkg -S */free$*
            – bobrobbob
            Jun 2 '17 at 9:23












          • @bobrobbob I am afraid that is not correct. I tested with dpkg -S */firefox$* which gives multiple results on a server which has Firefox installed, none on a server without Firefox. I think it can't work because dpkg is a command operating on the locally installed packages. To find non installed packages you can go to packages.ubuntu.com/…
            – Jeroen Vermeulen - MageHost
            Jun 2 '17 at 10:31










          • oh my. you're right, sorry for that
            – bobrobbob
            Jun 3 '17 at 6:32






          • 1




            If you get dpkg-query: no path found matching pattern try this: dpkg -S "$(readlink -fn "$(which free)")".
            – Pablo Bianchi
            Jul 7 '17 at 21:00




















          up vote
          5
          down vote













          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




























            up vote
            0
            down vote













            For all red-hat based distributions you can use yum package management utility



            yum provides `which free`


            provides argument specifies which package provides certain feature or file.






            share|improve this answer





















              Your Answer








              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "3"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f467186%2fhow-to-find-which-package-certain-command-belongs-to-on-centos%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              4 Answers
              4






              active

              oldest

              votes








              4 Answers
              4






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes








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















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













              up vote
              14
              down vote



              accepted







              up vote
              14
              down vote



              accepted






              Query the rpmdb.



              rpm -qf $(which free)





              share|improve this answer












              Query the rpmdb.



              rpm -qf $(which free)






              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Aug 28 '12 at 2:21









              Ignacio Vazquez-Abrams

              95.2k6150208




              95.2k6150208












              • 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


















              • 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
















              why not use rpm -qf which free?
              – hugemeow
              Sep 1 '12 at 9:35




              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




              Either is fine. $(...) is habit for me.
              – Ignacio Vazquez-Abrams
              Sep 1 '12 at 12:20












              up vote
              20
              down vote













              Ubuntu / Debian example to check the package of the free command:



              dpkg -S $(which free)





              share|improve this answer























              • this works only for installed packages. i found here something that works for non installed packages $ dpkg -S */free$*
                – bobrobbob
                Jun 2 '17 at 9:23












              • @bobrobbob I am afraid that is not correct. I tested with dpkg -S */firefox$* which gives multiple results on a server which has Firefox installed, none on a server without Firefox. I think it can't work because dpkg is a command operating on the locally installed packages. To find non installed packages you can go to packages.ubuntu.com/…
                – Jeroen Vermeulen - MageHost
                Jun 2 '17 at 10:31










              • oh my. you're right, sorry for that
                – bobrobbob
                Jun 3 '17 at 6:32






              • 1




                If you get dpkg-query: no path found matching pattern try this: dpkg -S "$(readlink -fn "$(which free)")".
                – Pablo Bianchi
                Jul 7 '17 at 21:00

















              up vote
              20
              down vote













              Ubuntu / Debian example to check the package of the free command:



              dpkg -S $(which free)





              share|improve this answer























              • this works only for installed packages. i found here something that works for non installed packages $ dpkg -S */free$*
                – bobrobbob
                Jun 2 '17 at 9:23












              • @bobrobbob I am afraid that is not correct. I tested with dpkg -S */firefox$* which gives multiple results on a server which has Firefox installed, none on a server without Firefox. I think it can't work because dpkg is a command operating on the locally installed packages. To find non installed packages you can go to packages.ubuntu.com/…
                – Jeroen Vermeulen - MageHost
                Jun 2 '17 at 10:31










              • oh my. you're right, sorry for that
                – bobrobbob
                Jun 3 '17 at 6:32






              • 1




                If you get dpkg-query: no path found matching pattern try this: dpkg -S "$(readlink -fn "$(which free)")".
                – Pablo Bianchi
                Jul 7 '17 at 21:00















              up vote
              20
              down vote










              up vote
              20
              down vote









              Ubuntu / Debian example to check the package of the free command:



              dpkg -S $(which free)





              share|improve this answer














              Ubuntu / Debian example to check the package of the free command:



              dpkg -S $(which free)






              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited Nov 21 at 14:22

























              answered Aug 28 '12 at 18:41









              Jeroen Vermeulen - MageHost

              72048




              72048












              • this works only for installed packages. i found here something that works for non installed packages $ dpkg -S */free$*
                – bobrobbob
                Jun 2 '17 at 9:23












              • @bobrobbob I am afraid that is not correct. I tested with dpkg -S */firefox$* which gives multiple results on a server which has Firefox installed, none on a server without Firefox. I think it can't work because dpkg is a command operating on the locally installed packages. To find non installed packages you can go to packages.ubuntu.com/…
                – Jeroen Vermeulen - MageHost
                Jun 2 '17 at 10:31










              • oh my. you're right, sorry for that
                – bobrobbob
                Jun 3 '17 at 6:32






              • 1




                If you get dpkg-query: no path found matching pattern try this: dpkg -S "$(readlink -fn "$(which free)")".
                – Pablo Bianchi
                Jul 7 '17 at 21:00




















              • this works only for installed packages. i found here something that works for non installed packages $ dpkg -S */free$*
                – bobrobbob
                Jun 2 '17 at 9:23












              • @bobrobbob I am afraid that is not correct. I tested with dpkg -S */firefox$* which gives multiple results on a server which has Firefox installed, none on a server without Firefox. I think it can't work because dpkg is a command operating on the locally installed packages. To find non installed packages you can go to packages.ubuntu.com/…
                – Jeroen Vermeulen - MageHost
                Jun 2 '17 at 10:31










              • oh my. you're right, sorry for that
                – bobrobbob
                Jun 3 '17 at 6:32






              • 1




                If you get dpkg-query: no path found matching pattern try this: dpkg -S "$(readlink -fn "$(which free)")".
                – Pablo Bianchi
                Jul 7 '17 at 21:00


















              this works only for installed packages. i found here something that works for non installed packages $ dpkg -S */free$*
              – bobrobbob
              Jun 2 '17 at 9:23






              this works only for installed packages. i found here something that works for non installed packages $ dpkg -S */free$*
              – bobrobbob
              Jun 2 '17 at 9:23














              @bobrobbob I am afraid that is not correct. I tested with dpkg -S */firefox$* which gives multiple results on a server which has Firefox installed, none on a server without Firefox. I think it can't work because dpkg is a command operating on the locally installed packages. To find non installed packages you can go to packages.ubuntu.com/…
              – Jeroen Vermeulen - MageHost
              Jun 2 '17 at 10:31




              @bobrobbob I am afraid that is not correct. I tested with dpkg -S */firefox$* which gives multiple results on a server which has Firefox installed, none on a server without Firefox. I think it can't work because dpkg is a command operating on the locally installed packages. To find non installed packages you can go to packages.ubuntu.com/…
              – Jeroen Vermeulen - MageHost
              Jun 2 '17 at 10:31












              oh my. you're right, sorry for that
              – bobrobbob
              Jun 3 '17 at 6:32




              oh my. you're right, sorry for that
              – bobrobbob
              Jun 3 '17 at 6:32




              1




              1




              If you get dpkg-query: no path found matching pattern try this: dpkg -S "$(readlink -fn "$(which free)")".
              – Pablo Bianchi
              Jul 7 '17 at 21:00






              If you get dpkg-query: no path found matching pattern try this: dpkg -S "$(readlink -fn "$(which free)")".
              – Pablo Bianchi
              Jul 7 '17 at 21:00












              up vote
              5
              down vote













              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

























                up vote
                5
                down vote













                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























                  up vote
                  5
                  down vote










                  up vote
                  5
                  down vote









                  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












                  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












                  share|improve this answer



                  share|improve this answer










                  answered Dec 17 '15 at 16:06









                  Mark

                  5111




                  5111






















                      up vote
                      0
                      down vote













                      For all red-hat based distributions you can use yum package management utility



                      yum provides `which free`


                      provides argument specifies which package provides certain feature or file.






                      share|improve this answer

























                        up vote
                        0
                        down vote













                        For all red-hat based distributions you can use yum package management utility



                        yum provides `which free`


                        provides argument specifies which package provides certain feature or file.






                        share|improve this answer























                          up vote
                          0
                          down vote










                          up vote
                          0
                          down vote









                          For all red-hat based distributions you can use yum package management utility



                          yum provides `which free`


                          provides argument specifies which package provides certain feature or file.






                          share|improve this answer












                          For all red-hat based distributions you can use yum package management utility



                          yum provides `which free`


                          provides argument specifies which package provides certain feature or file.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered May 13 at 15:36









                          LoveWithMaths

                          12




                          12






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Super User!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.





                              Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                              Please pay close attention to the following guidance:


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f467186%2fhow-to-find-which-package-certain-command-belongs-to-on-centos%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              AnyDesk - Fatal Program Failure

                              How to calibrate 16:9 built-in touch-screen to a 4:3 resolution?

                              QoS: MAC-Priority for clients behind a repeater