How do I find the package that provides a file?





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







435















Simple enough question: is there some shell command (or GUI method) I can use that, given the path to a file on my system, tells me what package put it there? Assuming the file did in fact come from a package, that is.



Bonus question: what if it's a file that isn't installed on my system? Is there, say, a website that will let me look up a file and see what packages, if any, provide it?










share|improve this question




















  • 6





    I've always wondered this myself - I know with YUM you can do yum whatprovides <filepath>/<filename> but I never really have found an alternative to that in Aptitude other than the Packages website

    – Marco Ceppi
    Jul 30 '10 at 13:44











  • Same on SU: superuser.com/questions/10997/…

    – Ciro Santilli 新疆改造中心996ICU六四事件
    May 21 '15 at 11:07











  • None of the answers here actually cover the Provides: mechanism. In some more detail, a command like mailx or sendmail is not included as a binary in any package; instead, various packages install their own binaries and then make some of them available under a "canonical" name via /etc/alternatives. See also askubuntu.com/questions/366135/…

    – tripleee
    Jan 26 '18 at 4:13




















435















Simple enough question: is there some shell command (or GUI method) I can use that, given the path to a file on my system, tells me what package put it there? Assuming the file did in fact come from a package, that is.



Bonus question: what if it's a file that isn't installed on my system? Is there, say, a website that will let me look up a file and see what packages, if any, provide it?










share|improve this question




















  • 6





    I've always wondered this myself - I know with YUM you can do yum whatprovides <filepath>/<filename> but I never really have found an alternative to that in Aptitude other than the Packages website

    – Marco Ceppi
    Jul 30 '10 at 13:44











  • Same on SU: superuser.com/questions/10997/…

    – Ciro Santilli 新疆改造中心996ICU六四事件
    May 21 '15 at 11:07











  • None of the answers here actually cover the Provides: mechanism. In some more detail, a command like mailx or sendmail is not included as a binary in any package; instead, various packages install their own binaries and then make some of them available under a "canonical" name via /etc/alternatives. See also askubuntu.com/questions/366135/…

    – tripleee
    Jan 26 '18 at 4:13
















435












435








435


121






Simple enough question: is there some shell command (or GUI method) I can use that, given the path to a file on my system, tells me what package put it there? Assuming the file did in fact come from a package, that is.



Bonus question: what if it's a file that isn't installed on my system? Is there, say, a website that will let me look up a file and see what packages, if any, provide it?










share|improve this question
















Simple enough question: is there some shell command (or GUI method) I can use that, given the path to a file on my system, tells me what package put it there? Assuming the file did in fact come from a package, that is.



Bonus question: what if it's a file that isn't installed on my system? Is there, say, a website that will let me look up a file and see what packages, if any, provide it?







package-management






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 22 '14 at 2:20









Braiam

52.7k20138223




52.7k20138223










asked Jul 30 '10 at 8:10









David ZDavid Z

3,95252021




3,95252021








  • 6





    I've always wondered this myself - I know with YUM you can do yum whatprovides <filepath>/<filename> but I never really have found an alternative to that in Aptitude other than the Packages website

    – Marco Ceppi
    Jul 30 '10 at 13:44











  • Same on SU: superuser.com/questions/10997/…

    – Ciro Santilli 新疆改造中心996ICU六四事件
    May 21 '15 at 11:07











  • None of the answers here actually cover the Provides: mechanism. In some more detail, a command like mailx or sendmail is not included as a binary in any package; instead, various packages install their own binaries and then make some of them available under a "canonical" name via /etc/alternatives. See also askubuntu.com/questions/366135/…

    – tripleee
    Jan 26 '18 at 4:13
















  • 6





    I've always wondered this myself - I know with YUM you can do yum whatprovides <filepath>/<filename> but I never really have found an alternative to that in Aptitude other than the Packages website

    – Marco Ceppi
    Jul 30 '10 at 13:44











  • Same on SU: superuser.com/questions/10997/…

    – Ciro Santilli 新疆改造中心996ICU六四事件
    May 21 '15 at 11:07











  • None of the answers here actually cover the Provides: mechanism. In some more detail, a command like mailx or sendmail is not included as a binary in any package; instead, various packages install their own binaries and then make some of them available under a "canonical" name via /etc/alternatives. See also askubuntu.com/questions/366135/…

    – tripleee
    Jan 26 '18 at 4:13










6




6





I've always wondered this myself - I know with YUM you can do yum whatprovides <filepath>/<filename> but I never really have found an alternative to that in Aptitude other than the Packages website

– Marco Ceppi
Jul 30 '10 at 13:44





I've always wondered this myself - I know with YUM you can do yum whatprovides <filepath>/<filename> but I never really have found an alternative to that in Aptitude other than the Packages website

– Marco Ceppi
Jul 30 '10 at 13:44













Same on SU: superuser.com/questions/10997/…

– Ciro Santilli 新疆改造中心996ICU六四事件
May 21 '15 at 11:07





Same on SU: superuser.com/questions/10997/…

– Ciro Santilli 新疆改造中心996ICU六四事件
May 21 '15 at 11:07













None of the answers here actually cover the Provides: mechanism. In some more detail, a command like mailx or sendmail is not included as a binary in any package; instead, various packages install their own binaries and then make some of them available under a "canonical" name via /etc/alternatives. See also askubuntu.com/questions/366135/…

– tripleee
Jan 26 '18 at 4:13







None of the answers here actually cover the Provides: mechanism. In some more detail, a command like mailx or sendmail is not included as a binary in any package; instead, various packages install their own binaries and then make some of them available under a "canonical" name via /etc/alternatives. See also askubuntu.com/questions/366135/…

– tripleee
Jan 26 '18 at 4:13












8 Answers
8






active

oldest

votes


















404














You can use dpkg command to find out which installed package owns a file:



From man dpkg:




-S, --search filename-search-pattern...
Search for a filename from installed packages.


Example:



$ dpkg -S /bin/ls
coreutils: /bin/ls


You can either search with a full path or with just the filename.



If you wish to search for files not yet installed on your computer, you can use the Ubuntu Packages Search






share|improve this answer





















  • 5





    I highly recommend using dlocate, which is updated daily for faster lookups.

    – Daniel T Chen
    Nov 23 '10 at 21:29






  • 15





    Hint: if you do not know the full path, but just the command name, use which to find he program: dpkg -S `which firefox`

    – Lekensteyn
    Jun 7 '11 at 15:38











  • This works for libraries as well, which is particularly handy if you have a binary that won't run because you can inspect it with ldd and use the full library paths to find the packages you are missing.

    – Alain O'Dea
    Oct 23 '14 at 14:41






  • 1





    @DanielTChen, but dlocate may not do the job, if dlocate's database is out of date. You have to call sudo update-dlocatedb to update it.

    – jarno
    Jun 14 '15 at 14:40






  • 2





    If dpkg the exact path doesn't return anything (e.g. dpkg /usr/bin/java), try just the executable's name (e.g. dpkg java).

    – Dan Dascalescu
    Jan 21 '16 at 1:05



















218














The apt-file command can do this for you from the command line. I use it frequently when building packages from source. For files provided by packages that are already installed on your system, apt-cache is another choice.



To install apt-file, do:



sudo apt-get install apt-file


Then, you need to update it's database:



apt-file update


And, finally, search the file:



$ apt-file find kwallet.h
kdelibs5-dev: /usr/include/kwallet.h
libkf5wallet-dev: /usr/include/KF5/KWallet/kwallet.h


However a much friendlier way is to use the Ubuntu Packages Search website. They have an option to "search the contents of packages" for a specific filename.






share|improve this answer





















  • 16





    In my opinion this should be the accepted answer. But in response to Ubuntu Packages Search, I might argue that a shell program this simple is extremely friendly and easy to remember (once you know it). If you use dpkg, apt-get, or aptitude as your standard tools, there is nothing friendly about firing up Chrome to surf the internet!

    – user2097818
    Apr 1 '16 at 6:00






  • 3





    @user2097818 The reason this isn't the accepted answer is that my primary question is restricted to files on the system and packages which are installed. apt-file often finds false positives, i.e. packages that aren't installed. Of course this answer is great for the "bonus question".

    – David Z
    Apr 3 '18 at 23:36






  • 2





    For those from the Redhat side of the world - apt-file search <> is the closest analog to dnf/yum whatprovides <>.

    – ffledgling
    Apr 29 '18 at 20:14



















43














There's also apt-file for looking up files in packages that aren't installed. For example:



apt-file list packagename





share|improve this answer

































    17














    You can search the contents of packages included in the various Ubuntu releases on the Ubuntu Packages website. Look under the heading "Search the contents of packages".



    For example, here are the search results for libnss3.so in lucid (10.04):



    http://packages.ubuntu.com/search?searchon=contents&keywords=libnss3.so&mode=exactfilename&suite=lucid&arch=any






    share|improve this answer































      13














      You mean, which package and not which application. The application is your package manager, e.g. Software Center.



      Using dpkg:



      dpkg -S /usr/lib/tracker/tracker-store
      dpkg -S tracker-extract
      dpkg -S tracker-miner-fs


      Example



      % dpkg -S /usr/lib/tracker/tracker-store
      tracker: /usr/lib/tracker/tracker-store




      Using apt-file:



      apt-file search /usr/lib/tracker/tracker-store


      or also possible:



      apt-file search --regex /tracker-extract$
      apt-file search --regex /tracker-miner-fs$


      Example



      % apt-file search /usr/lib/tracker/tracker-store
      tracker: /usr/lib/tracker/tracker-store




      Or online here, in the section Search the contents of packages.



      enter image description here



      Example



      enter image description here






      share|improve this answer


























      • You mean, which package and not which application. The application is your package manager, e.g. Software Center. Okay. Thank you! :)

        – ReyKev
        Nov 29 '15 at 17:14













      • Thank you for all the help! None of these suggestions helped me find which package installed this/these applications though. All searches just lead back to "Tracker". I suspected it was Enthoughts' Canopy though. That mile long EULA reminded me of my old Microsoft Windows daze, with which, I am so glad I am no longer involved. I saw that Tracker was installed yesterday so, as root, I got rid of it, along with Enthoughts' Canopy and, all problems are solved. I really thank you for all your help. It is such a great thing to have such support. Thanks again! Kevin

        – ReyKev
        Nov 29 '15 at 17:22



















      3














      I was trying to track down what installed which on my system. After a little work I created apt-whatprovides



      #!/bin/sh
      #apt-whatprovides ver. 201801010101 Copyright alexx, MIT Licence
      #rdfa:deps="[realpath,apt-file,grep,which,sh,echo]"

      BINARY=$(realpath $(which $@))
      PACKAGE=$(apt-file search $BINARY|grep -E ":s*${BINARY}$")
      echo ${PACKAGE%:*}


      Though for most THINGs you can just use



      apt-file search $(realpath $(which THING))|grep 'THING$'





      share|improve this answer



















      • 1





        Alexx, I love this answer. I hope you don't mind my edit. I made it also work for files that are not installed on the system. I made a backup at gist.github.com/RichardBronosky/… and will create my own answer if you revert/reject it.

        – Bruno Bronosky
        Jul 15 '18 at 5:00











      • Update: It feels slimy to copy pasta this answer and make subtle changes to it, but my edit got rejected. I hope you feel like I maintained the integrity of your answer in mine.

        – Bruno Bronosky
        Jul 18 '18 at 5:47













      • Feel free to edit or hack; anything that makes it better for you, (that's why I added MIT Licence! I don't even need credit.)

        – Alexx Roche
        Jul 30 '18 at 11:41



















      3














      This is an extension to Alexx Roche's excellent answer. I tried to make an edit to that answer, but it got rejected (though not by Alexx)





      I was trying to track down what installed which on my system. After a little work I created /usr/local/bin/apt-whatprovides



      #!/bin/sh
      #apt-whatprovides ver. 201801010101 Copyright alexx, MIT Licence
      #rdfa:deps="[realpath,apt-file,grep,which,sh,echo]"

      BINARY="$(realpath $(which $@) 2>/dev/null)"
      [ -z "$BINARY" ] && BINARY="$@"
      echo Searching for $BINARY
      PACKAGE="$(apt-file search $BINARY|grep -E ":.*[^-.a-zA-Z0-9]${BINARY}$")"
      echo "${PACKAGE}"


      Though for most THINGs that are installed you can just use:



      apt-file search $(realpath $(which THING)) | grep 'THING$'


      For THINGs that are not installed, you can use:



      apt-file search THING | grep '/THING$'


      The apt-whatprovides script works for files that are and are not on your system. For example, my system lacked dig but had ping so this it what resulted:



      pi@raspberrypi:~ $ apt-whatprovides ping
      Searching for /bin/ping
      inetutils-ping: /bin/ping
      iputils-ping: /bin/ping

      pi@raspberrypi:~ $ apt-whatprovides dig
      Searching for dig
      dnsutils: /usr/bin/dig
      epic4: /usr/share/epic4/script/dig
      epic4-help: /usr/share/epic4/help/8_Scripts/dig
      knot-dnsutils: /usr/bin/dig


      Notice that Searching for is a complete path for ping (installed) and just the binary name for dig not installed. This helped me discover that I needed to install dnsutils without needing to go search https://packages.ubuntu.com/#search_contents






      share|improve this answer


























      • This is such a good answer that I should delete mine!

        – Alexx Roche
        Jul 30 '18 at 11:49



















      2














      One reason you might have to do this is if you are compiling software which there already is an ubuntu package, you can run apt-get build-dep $PACKAGENAME. That will install all packages you need to compile $PACKAGENAME.






      share|improve this answer
























        Your Answer








        StackExchange.ready(function() {
        var channelOptions = {
        tags: "".split(" "),
        id: "89"
        };
        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',
        autoActivateHeartbeat: false,
        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%2faskubuntu.com%2fquestions%2f481%2fhow-do-i-find-the-package-that-provides-a-file%23new-answer', 'question_page');
        }
        );

        Post as a guest















        Required, but never shown

























        8 Answers
        8






        active

        oldest

        votes








        8 Answers
        8






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        404














        You can use dpkg command to find out which installed package owns a file:



        From man dpkg:




        -S, --search filename-search-pattern...
        Search for a filename from installed packages.


        Example:



        $ dpkg -S /bin/ls
        coreutils: /bin/ls


        You can either search with a full path or with just the filename.



        If you wish to search for files not yet installed on your computer, you can use the Ubuntu Packages Search






        share|improve this answer





















        • 5





          I highly recommend using dlocate, which is updated daily for faster lookups.

          – Daniel T Chen
          Nov 23 '10 at 21:29






        • 15





          Hint: if you do not know the full path, but just the command name, use which to find he program: dpkg -S `which firefox`

          – Lekensteyn
          Jun 7 '11 at 15:38











        • This works for libraries as well, which is particularly handy if you have a binary that won't run because you can inspect it with ldd and use the full library paths to find the packages you are missing.

          – Alain O'Dea
          Oct 23 '14 at 14:41






        • 1





          @DanielTChen, but dlocate may not do the job, if dlocate's database is out of date. You have to call sudo update-dlocatedb to update it.

          – jarno
          Jun 14 '15 at 14:40






        • 2





          If dpkg the exact path doesn't return anything (e.g. dpkg /usr/bin/java), try just the executable's name (e.g. dpkg java).

          – Dan Dascalescu
          Jan 21 '16 at 1:05
















        404














        You can use dpkg command to find out which installed package owns a file:



        From man dpkg:




        -S, --search filename-search-pattern...
        Search for a filename from installed packages.


        Example:



        $ dpkg -S /bin/ls
        coreutils: /bin/ls


        You can either search with a full path or with just the filename.



        If you wish to search for files not yet installed on your computer, you can use the Ubuntu Packages Search






        share|improve this answer





















        • 5





          I highly recommend using dlocate, which is updated daily for faster lookups.

          – Daniel T Chen
          Nov 23 '10 at 21:29






        • 15





          Hint: if you do not know the full path, but just the command name, use which to find he program: dpkg -S `which firefox`

          – Lekensteyn
          Jun 7 '11 at 15:38











        • This works for libraries as well, which is particularly handy if you have a binary that won't run because you can inspect it with ldd and use the full library paths to find the packages you are missing.

          – Alain O'Dea
          Oct 23 '14 at 14:41






        • 1





          @DanielTChen, but dlocate may not do the job, if dlocate's database is out of date. You have to call sudo update-dlocatedb to update it.

          – jarno
          Jun 14 '15 at 14:40






        • 2





          If dpkg the exact path doesn't return anything (e.g. dpkg /usr/bin/java), try just the executable's name (e.g. dpkg java).

          – Dan Dascalescu
          Jan 21 '16 at 1:05














        404












        404








        404







        You can use dpkg command to find out which installed package owns a file:



        From man dpkg:




        -S, --search filename-search-pattern...
        Search for a filename from installed packages.


        Example:



        $ dpkg -S /bin/ls
        coreutils: /bin/ls


        You can either search with a full path or with just the filename.



        If you wish to search for files not yet installed on your computer, you can use the Ubuntu Packages Search






        share|improve this answer















        You can use dpkg command to find out which installed package owns a file:



        From man dpkg:




        -S, --search filename-search-pattern...
        Search for a filename from installed packages.


        Example:



        $ dpkg -S /bin/ls
        coreutils: /bin/ls


        You can either search with a full path or with just the filename.



        If you wish to search for files not yet installed on your computer, you can use the Ubuntu Packages Search







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Mar 15 '18 at 19:34









        N0rbert

        25.3k853120




        25.3k853120










        answered Jul 30 '10 at 8:42









        RessuRessu

        8,76013027




        8,76013027








        • 5





          I highly recommend using dlocate, which is updated daily for faster lookups.

          – Daniel T Chen
          Nov 23 '10 at 21:29






        • 15





          Hint: if you do not know the full path, but just the command name, use which to find he program: dpkg -S `which firefox`

          – Lekensteyn
          Jun 7 '11 at 15:38











        • This works for libraries as well, which is particularly handy if you have a binary that won't run because you can inspect it with ldd and use the full library paths to find the packages you are missing.

          – Alain O'Dea
          Oct 23 '14 at 14:41






        • 1





          @DanielTChen, but dlocate may not do the job, if dlocate's database is out of date. You have to call sudo update-dlocatedb to update it.

          – jarno
          Jun 14 '15 at 14:40






        • 2





          If dpkg the exact path doesn't return anything (e.g. dpkg /usr/bin/java), try just the executable's name (e.g. dpkg java).

          – Dan Dascalescu
          Jan 21 '16 at 1:05














        • 5





          I highly recommend using dlocate, which is updated daily for faster lookups.

          – Daniel T Chen
          Nov 23 '10 at 21:29






        • 15





          Hint: if you do not know the full path, but just the command name, use which to find he program: dpkg -S `which firefox`

          – Lekensteyn
          Jun 7 '11 at 15:38











        • This works for libraries as well, which is particularly handy if you have a binary that won't run because you can inspect it with ldd and use the full library paths to find the packages you are missing.

          – Alain O'Dea
          Oct 23 '14 at 14:41






        • 1





          @DanielTChen, but dlocate may not do the job, if dlocate's database is out of date. You have to call sudo update-dlocatedb to update it.

          – jarno
          Jun 14 '15 at 14:40






        • 2





          If dpkg the exact path doesn't return anything (e.g. dpkg /usr/bin/java), try just the executable's name (e.g. dpkg java).

          – Dan Dascalescu
          Jan 21 '16 at 1:05








        5




        5





        I highly recommend using dlocate, which is updated daily for faster lookups.

        – Daniel T Chen
        Nov 23 '10 at 21:29





        I highly recommend using dlocate, which is updated daily for faster lookups.

        – Daniel T Chen
        Nov 23 '10 at 21:29




        15




        15





        Hint: if you do not know the full path, but just the command name, use which to find he program: dpkg -S `which firefox`

        – Lekensteyn
        Jun 7 '11 at 15:38





        Hint: if you do not know the full path, but just the command name, use which to find he program: dpkg -S `which firefox`

        – Lekensteyn
        Jun 7 '11 at 15:38













        This works for libraries as well, which is particularly handy if you have a binary that won't run because you can inspect it with ldd and use the full library paths to find the packages you are missing.

        – Alain O'Dea
        Oct 23 '14 at 14:41





        This works for libraries as well, which is particularly handy if you have a binary that won't run because you can inspect it with ldd and use the full library paths to find the packages you are missing.

        – Alain O'Dea
        Oct 23 '14 at 14:41




        1




        1





        @DanielTChen, but dlocate may not do the job, if dlocate's database is out of date. You have to call sudo update-dlocatedb to update it.

        – jarno
        Jun 14 '15 at 14:40





        @DanielTChen, but dlocate may not do the job, if dlocate's database is out of date. You have to call sudo update-dlocatedb to update it.

        – jarno
        Jun 14 '15 at 14:40




        2




        2





        If dpkg the exact path doesn't return anything (e.g. dpkg /usr/bin/java), try just the executable's name (e.g. dpkg java).

        – Dan Dascalescu
        Jan 21 '16 at 1:05





        If dpkg the exact path doesn't return anything (e.g. dpkg /usr/bin/java), try just the executable's name (e.g. dpkg java).

        – Dan Dascalescu
        Jan 21 '16 at 1:05













        218














        The apt-file command can do this for you from the command line. I use it frequently when building packages from source. For files provided by packages that are already installed on your system, apt-cache is another choice.



        To install apt-file, do:



        sudo apt-get install apt-file


        Then, you need to update it's database:



        apt-file update


        And, finally, search the file:



        $ apt-file find kwallet.h
        kdelibs5-dev: /usr/include/kwallet.h
        libkf5wallet-dev: /usr/include/KF5/KWallet/kwallet.h


        However a much friendlier way is to use the Ubuntu Packages Search website. They have an option to "search the contents of packages" for a specific filename.






        share|improve this answer





















        • 16





          In my opinion this should be the accepted answer. But in response to Ubuntu Packages Search, I might argue that a shell program this simple is extremely friendly and easy to remember (once you know it). If you use dpkg, apt-get, or aptitude as your standard tools, there is nothing friendly about firing up Chrome to surf the internet!

          – user2097818
          Apr 1 '16 at 6:00






        • 3





          @user2097818 The reason this isn't the accepted answer is that my primary question is restricted to files on the system and packages which are installed. apt-file often finds false positives, i.e. packages that aren't installed. Of course this answer is great for the "bonus question".

          – David Z
          Apr 3 '18 at 23:36






        • 2





          For those from the Redhat side of the world - apt-file search <> is the closest analog to dnf/yum whatprovides <>.

          – ffledgling
          Apr 29 '18 at 20:14
















        218














        The apt-file command can do this for you from the command line. I use it frequently when building packages from source. For files provided by packages that are already installed on your system, apt-cache is another choice.



        To install apt-file, do:



        sudo apt-get install apt-file


        Then, you need to update it's database:



        apt-file update


        And, finally, search the file:



        $ apt-file find kwallet.h
        kdelibs5-dev: /usr/include/kwallet.h
        libkf5wallet-dev: /usr/include/KF5/KWallet/kwallet.h


        However a much friendlier way is to use the Ubuntu Packages Search website. They have an option to "search the contents of packages" for a specific filename.






        share|improve this answer





















        • 16





          In my opinion this should be the accepted answer. But in response to Ubuntu Packages Search, I might argue that a shell program this simple is extremely friendly and easy to remember (once you know it). If you use dpkg, apt-get, or aptitude as your standard tools, there is nothing friendly about firing up Chrome to surf the internet!

          – user2097818
          Apr 1 '16 at 6:00






        • 3





          @user2097818 The reason this isn't the accepted answer is that my primary question is restricted to files on the system and packages which are installed. apt-file often finds false positives, i.e. packages that aren't installed. Of course this answer is great for the "bonus question".

          – David Z
          Apr 3 '18 at 23:36






        • 2





          For those from the Redhat side of the world - apt-file search <> is the closest analog to dnf/yum whatprovides <>.

          – ffledgling
          Apr 29 '18 at 20:14














        218












        218








        218







        The apt-file command can do this for you from the command line. I use it frequently when building packages from source. For files provided by packages that are already installed on your system, apt-cache is another choice.



        To install apt-file, do:



        sudo apt-get install apt-file


        Then, you need to update it's database:



        apt-file update


        And, finally, search the file:



        $ apt-file find kwallet.h
        kdelibs5-dev: /usr/include/kwallet.h
        libkf5wallet-dev: /usr/include/KF5/KWallet/kwallet.h


        However a much friendlier way is to use the Ubuntu Packages Search website. They have an option to "search the contents of packages" for a specific filename.






        share|improve this answer















        The apt-file command can do this for you from the command line. I use it frequently when building packages from source. For files provided by packages that are already installed on your system, apt-cache is another choice.



        To install apt-file, do:



        sudo apt-get install apt-file


        Then, you need to update it's database:



        apt-file update


        And, finally, search the file:



        $ apt-file find kwallet.h
        kdelibs5-dev: /usr/include/kwallet.h
        libkf5wallet-dev: /usr/include/KF5/KWallet/kwallet.h


        However a much friendlier way is to use the Ubuntu Packages Search website. They have an option to "search the contents of packages" for a specific filename.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Dec 3 '14 at 11:34









        Danatela

        9,41493264




        9,41493264










        answered Aug 11 '10 at 2:43









        jbowtiejbowtie

        8,10632029




        8,10632029








        • 16





          In my opinion this should be the accepted answer. But in response to Ubuntu Packages Search, I might argue that a shell program this simple is extremely friendly and easy to remember (once you know it). If you use dpkg, apt-get, or aptitude as your standard tools, there is nothing friendly about firing up Chrome to surf the internet!

          – user2097818
          Apr 1 '16 at 6:00






        • 3





          @user2097818 The reason this isn't the accepted answer is that my primary question is restricted to files on the system and packages which are installed. apt-file often finds false positives, i.e. packages that aren't installed. Of course this answer is great for the "bonus question".

          – David Z
          Apr 3 '18 at 23:36






        • 2





          For those from the Redhat side of the world - apt-file search <> is the closest analog to dnf/yum whatprovides <>.

          – ffledgling
          Apr 29 '18 at 20:14














        • 16





          In my opinion this should be the accepted answer. But in response to Ubuntu Packages Search, I might argue that a shell program this simple is extremely friendly and easy to remember (once you know it). If you use dpkg, apt-get, or aptitude as your standard tools, there is nothing friendly about firing up Chrome to surf the internet!

          – user2097818
          Apr 1 '16 at 6:00






        • 3





          @user2097818 The reason this isn't the accepted answer is that my primary question is restricted to files on the system and packages which are installed. apt-file often finds false positives, i.e. packages that aren't installed. Of course this answer is great for the "bonus question".

          – David Z
          Apr 3 '18 at 23:36






        • 2





          For those from the Redhat side of the world - apt-file search <> is the closest analog to dnf/yum whatprovides <>.

          – ffledgling
          Apr 29 '18 at 20:14








        16




        16





        In my opinion this should be the accepted answer. But in response to Ubuntu Packages Search, I might argue that a shell program this simple is extremely friendly and easy to remember (once you know it). If you use dpkg, apt-get, or aptitude as your standard tools, there is nothing friendly about firing up Chrome to surf the internet!

        – user2097818
        Apr 1 '16 at 6:00





        In my opinion this should be the accepted answer. But in response to Ubuntu Packages Search, I might argue that a shell program this simple is extremely friendly and easy to remember (once you know it). If you use dpkg, apt-get, or aptitude as your standard tools, there is nothing friendly about firing up Chrome to surf the internet!

        – user2097818
        Apr 1 '16 at 6:00




        3




        3





        @user2097818 The reason this isn't the accepted answer is that my primary question is restricted to files on the system and packages which are installed. apt-file often finds false positives, i.e. packages that aren't installed. Of course this answer is great for the "bonus question".

        – David Z
        Apr 3 '18 at 23:36





        @user2097818 The reason this isn't the accepted answer is that my primary question is restricted to files on the system and packages which are installed. apt-file often finds false positives, i.e. packages that aren't installed. Of course this answer is great for the "bonus question".

        – David Z
        Apr 3 '18 at 23:36




        2




        2





        For those from the Redhat side of the world - apt-file search <> is the closest analog to dnf/yum whatprovides <>.

        – ffledgling
        Apr 29 '18 at 20:14





        For those from the Redhat side of the world - apt-file search <> is the closest analog to dnf/yum whatprovides <>.

        – ffledgling
        Apr 29 '18 at 20:14











        43














        There's also apt-file for looking up files in packages that aren't installed. For example:



        apt-file list packagename





        share|improve this answer






























          43














          There's also apt-file for looking up files in packages that aren't installed. For example:



          apt-file list packagename





          share|improve this answer




























            43












            43








            43







            There's also apt-file for looking up files in packages that aren't installed. For example:



            apt-file list packagename





            share|improve this answer















            There's also apt-file for looking up files in packages that aren't installed. For example:



            apt-file list packagename






            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Jan 14 '17 at 17:55









            muru

            1




            1










            answered Jul 30 '10 at 8:49









            ptmanptman

            54135




            54135























                17














                You can search the contents of packages included in the various Ubuntu releases on the Ubuntu Packages website. Look under the heading "Search the contents of packages".



                For example, here are the search results for libnss3.so in lucid (10.04):



                http://packages.ubuntu.com/search?searchon=contents&keywords=libnss3.so&mode=exactfilename&suite=lucid&arch=any






                share|improve this answer




























                  17














                  You can search the contents of packages included in the various Ubuntu releases on the Ubuntu Packages website. Look under the heading "Search the contents of packages".



                  For example, here are the search results for libnss3.so in lucid (10.04):



                  http://packages.ubuntu.com/search?searchon=contents&keywords=libnss3.so&mode=exactfilename&suite=lucid&arch=any






                  share|improve this answer


























                    17












                    17








                    17







                    You can search the contents of packages included in the various Ubuntu releases on the Ubuntu Packages website. Look under the heading "Search the contents of packages".



                    For example, here are the search results for libnss3.so in lucid (10.04):



                    http://packages.ubuntu.com/search?searchon=contents&keywords=libnss3.so&mode=exactfilename&suite=lucid&arch=any






                    share|improve this answer













                    You can search the contents of packages included in the various Ubuntu releases on the Ubuntu Packages website. Look under the heading "Search the contents of packages".



                    For example, here are the search results for libnss3.so in lucid (10.04):



                    http://packages.ubuntu.com/search?searchon=contents&keywords=libnss3.so&mode=exactfilename&suite=lucid&arch=any







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Aug 11 '10 at 2:42









                    moberleymoberley

                    837915




                    837915























                        13














                        You mean, which package and not which application. The application is your package manager, e.g. Software Center.



                        Using dpkg:



                        dpkg -S /usr/lib/tracker/tracker-store
                        dpkg -S tracker-extract
                        dpkg -S tracker-miner-fs


                        Example



                        % dpkg -S /usr/lib/tracker/tracker-store
                        tracker: /usr/lib/tracker/tracker-store




                        Using apt-file:



                        apt-file search /usr/lib/tracker/tracker-store


                        or also possible:



                        apt-file search --regex /tracker-extract$
                        apt-file search --regex /tracker-miner-fs$


                        Example



                        % apt-file search /usr/lib/tracker/tracker-store
                        tracker: /usr/lib/tracker/tracker-store




                        Or online here, in the section Search the contents of packages.



                        enter image description here



                        Example



                        enter image description here






                        share|improve this answer


























                        • You mean, which package and not which application. The application is your package manager, e.g. Software Center. Okay. Thank you! :)

                          – ReyKev
                          Nov 29 '15 at 17:14













                        • Thank you for all the help! None of these suggestions helped me find which package installed this/these applications though. All searches just lead back to "Tracker". I suspected it was Enthoughts' Canopy though. That mile long EULA reminded me of my old Microsoft Windows daze, with which, I am so glad I am no longer involved. I saw that Tracker was installed yesterday so, as root, I got rid of it, along with Enthoughts' Canopy and, all problems are solved. I really thank you for all your help. It is such a great thing to have such support. Thanks again! Kevin

                          – ReyKev
                          Nov 29 '15 at 17:22
















                        13














                        You mean, which package and not which application. The application is your package manager, e.g. Software Center.



                        Using dpkg:



                        dpkg -S /usr/lib/tracker/tracker-store
                        dpkg -S tracker-extract
                        dpkg -S tracker-miner-fs


                        Example



                        % dpkg -S /usr/lib/tracker/tracker-store
                        tracker: /usr/lib/tracker/tracker-store




                        Using apt-file:



                        apt-file search /usr/lib/tracker/tracker-store


                        or also possible:



                        apt-file search --regex /tracker-extract$
                        apt-file search --regex /tracker-miner-fs$


                        Example



                        % apt-file search /usr/lib/tracker/tracker-store
                        tracker: /usr/lib/tracker/tracker-store




                        Or online here, in the section Search the contents of packages.



                        enter image description here



                        Example



                        enter image description here






                        share|improve this answer


























                        • You mean, which package and not which application. The application is your package manager, e.g. Software Center. Okay. Thank you! :)

                          – ReyKev
                          Nov 29 '15 at 17:14













                        • Thank you for all the help! None of these suggestions helped me find which package installed this/these applications though. All searches just lead back to "Tracker". I suspected it was Enthoughts' Canopy though. That mile long EULA reminded me of my old Microsoft Windows daze, with which, I am so glad I am no longer involved. I saw that Tracker was installed yesterday so, as root, I got rid of it, along with Enthoughts' Canopy and, all problems are solved. I really thank you for all your help. It is such a great thing to have such support. Thanks again! Kevin

                          – ReyKev
                          Nov 29 '15 at 17:22














                        13












                        13








                        13







                        You mean, which package and not which application. The application is your package manager, e.g. Software Center.



                        Using dpkg:



                        dpkg -S /usr/lib/tracker/tracker-store
                        dpkg -S tracker-extract
                        dpkg -S tracker-miner-fs


                        Example



                        % dpkg -S /usr/lib/tracker/tracker-store
                        tracker: /usr/lib/tracker/tracker-store




                        Using apt-file:



                        apt-file search /usr/lib/tracker/tracker-store


                        or also possible:



                        apt-file search --regex /tracker-extract$
                        apt-file search --regex /tracker-miner-fs$


                        Example



                        % apt-file search /usr/lib/tracker/tracker-store
                        tracker: /usr/lib/tracker/tracker-store




                        Or online here, in the section Search the contents of packages.



                        enter image description here



                        Example



                        enter image description here






                        share|improve this answer















                        You mean, which package and not which application. The application is your package manager, e.g. Software Center.



                        Using dpkg:



                        dpkg -S /usr/lib/tracker/tracker-store
                        dpkg -S tracker-extract
                        dpkg -S tracker-miner-fs


                        Example



                        % dpkg -S /usr/lib/tracker/tracker-store
                        tracker: /usr/lib/tracker/tracker-store




                        Using apt-file:



                        apt-file search /usr/lib/tracker/tracker-store


                        or also possible:



                        apt-file search --regex /tracker-extract$
                        apt-file search --regex /tracker-miner-fs$


                        Example



                        % apt-file search /usr/lib/tracker/tracker-store
                        tracker: /usr/lib/tracker/tracker-store




                        Or online here, in the section Search the contents of packages.



                        enter image description here



                        Example



                        enter image description here







                        share|improve this answer














                        share|improve this answer



                        share|improve this answer








                        edited Feb 9 '18 at 11:05









                        Chai T. Rex

                        4,20711536




                        4,20711536










                        answered Nov 29 '15 at 15:57









                        A.B.A.B.

                        69.9k12172267




                        69.9k12172267













                        • You mean, which package and not which application. The application is your package manager, e.g. Software Center. Okay. Thank you! :)

                          – ReyKev
                          Nov 29 '15 at 17:14













                        • Thank you for all the help! None of these suggestions helped me find which package installed this/these applications though. All searches just lead back to "Tracker". I suspected it was Enthoughts' Canopy though. That mile long EULA reminded me of my old Microsoft Windows daze, with which, I am so glad I am no longer involved. I saw that Tracker was installed yesterday so, as root, I got rid of it, along with Enthoughts' Canopy and, all problems are solved. I really thank you for all your help. It is such a great thing to have such support. Thanks again! Kevin

                          – ReyKev
                          Nov 29 '15 at 17:22



















                        • You mean, which package and not which application. The application is your package manager, e.g. Software Center. Okay. Thank you! :)

                          – ReyKev
                          Nov 29 '15 at 17:14













                        • Thank you for all the help! None of these suggestions helped me find which package installed this/these applications though. All searches just lead back to "Tracker". I suspected it was Enthoughts' Canopy though. That mile long EULA reminded me of my old Microsoft Windows daze, with which, I am so glad I am no longer involved. I saw that Tracker was installed yesterday so, as root, I got rid of it, along with Enthoughts' Canopy and, all problems are solved. I really thank you for all your help. It is such a great thing to have such support. Thanks again! Kevin

                          – ReyKev
                          Nov 29 '15 at 17:22

















                        You mean, which package and not which application. The application is your package manager, e.g. Software Center. Okay. Thank you! :)

                        – ReyKev
                        Nov 29 '15 at 17:14







                        You mean, which package and not which application. The application is your package manager, e.g. Software Center. Okay. Thank you! :)

                        – ReyKev
                        Nov 29 '15 at 17:14















                        Thank you for all the help! None of these suggestions helped me find which package installed this/these applications though. All searches just lead back to "Tracker". I suspected it was Enthoughts' Canopy though. That mile long EULA reminded me of my old Microsoft Windows daze, with which, I am so glad I am no longer involved. I saw that Tracker was installed yesterday so, as root, I got rid of it, along with Enthoughts' Canopy and, all problems are solved. I really thank you for all your help. It is such a great thing to have such support. Thanks again! Kevin

                        – ReyKev
                        Nov 29 '15 at 17:22





                        Thank you for all the help! None of these suggestions helped me find which package installed this/these applications though. All searches just lead back to "Tracker". I suspected it was Enthoughts' Canopy though. That mile long EULA reminded me of my old Microsoft Windows daze, with which, I am so glad I am no longer involved. I saw that Tracker was installed yesterday so, as root, I got rid of it, along with Enthoughts' Canopy and, all problems are solved. I really thank you for all your help. It is such a great thing to have such support. Thanks again! Kevin

                        – ReyKev
                        Nov 29 '15 at 17:22











                        3














                        I was trying to track down what installed which on my system. After a little work I created apt-whatprovides



                        #!/bin/sh
                        #apt-whatprovides ver. 201801010101 Copyright alexx, MIT Licence
                        #rdfa:deps="[realpath,apt-file,grep,which,sh,echo]"

                        BINARY=$(realpath $(which $@))
                        PACKAGE=$(apt-file search $BINARY|grep -E ":s*${BINARY}$")
                        echo ${PACKAGE%:*}


                        Though for most THINGs you can just use



                        apt-file search $(realpath $(which THING))|grep 'THING$'





                        share|improve this answer



















                        • 1





                          Alexx, I love this answer. I hope you don't mind my edit. I made it also work for files that are not installed on the system. I made a backup at gist.github.com/RichardBronosky/… and will create my own answer if you revert/reject it.

                          – Bruno Bronosky
                          Jul 15 '18 at 5:00











                        • Update: It feels slimy to copy pasta this answer and make subtle changes to it, but my edit got rejected. I hope you feel like I maintained the integrity of your answer in mine.

                          – Bruno Bronosky
                          Jul 18 '18 at 5:47













                        • Feel free to edit or hack; anything that makes it better for you, (that's why I added MIT Licence! I don't even need credit.)

                          – Alexx Roche
                          Jul 30 '18 at 11:41
















                        3














                        I was trying to track down what installed which on my system. After a little work I created apt-whatprovides



                        #!/bin/sh
                        #apt-whatprovides ver. 201801010101 Copyright alexx, MIT Licence
                        #rdfa:deps="[realpath,apt-file,grep,which,sh,echo]"

                        BINARY=$(realpath $(which $@))
                        PACKAGE=$(apt-file search $BINARY|grep -E ":s*${BINARY}$")
                        echo ${PACKAGE%:*}


                        Though for most THINGs you can just use



                        apt-file search $(realpath $(which THING))|grep 'THING$'





                        share|improve this answer



















                        • 1





                          Alexx, I love this answer. I hope you don't mind my edit. I made it also work for files that are not installed on the system. I made a backup at gist.github.com/RichardBronosky/… and will create my own answer if you revert/reject it.

                          – Bruno Bronosky
                          Jul 15 '18 at 5:00











                        • Update: It feels slimy to copy pasta this answer and make subtle changes to it, but my edit got rejected. I hope you feel like I maintained the integrity of your answer in mine.

                          – Bruno Bronosky
                          Jul 18 '18 at 5:47













                        • Feel free to edit or hack; anything that makes it better for you, (that's why I added MIT Licence! I don't even need credit.)

                          – Alexx Roche
                          Jul 30 '18 at 11:41














                        3












                        3








                        3







                        I was trying to track down what installed which on my system. After a little work I created apt-whatprovides



                        #!/bin/sh
                        #apt-whatprovides ver. 201801010101 Copyright alexx, MIT Licence
                        #rdfa:deps="[realpath,apt-file,grep,which,sh,echo]"

                        BINARY=$(realpath $(which $@))
                        PACKAGE=$(apt-file search $BINARY|grep -E ":s*${BINARY}$")
                        echo ${PACKAGE%:*}


                        Though for most THINGs you can just use



                        apt-file search $(realpath $(which THING))|grep 'THING$'





                        share|improve this answer













                        I was trying to track down what installed which on my system. After a little work I created apt-whatprovides



                        #!/bin/sh
                        #apt-whatprovides ver. 201801010101 Copyright alexx, MIT Licence
                        #rdfa:deps="[realpath,apt-file,grep,which,sh,echo]"

                        BINARY=$(realpath $(which $@))
                        PACKAGE=$(apt-file search $BINARY|grep -E ":s*${BINARY}$")
                        echo ${PACKAGE%:*}


                        Though for most THINGs you can just use



                        apt-file search $(realpath $(which THING))|grep 'THING$'






                        share|improve this answer












                        share|improve this answer



                        share|improve this answer










                        answered Mar 17 '18 at 15:25









                        Alexx RocheAlexx Roche

                        1936




                        1936








                        • 1





                          Alexx, I love this answer. I hope you don't mind my edit. I made it also work for files that are not installed on the system. I made a backup at gist.github.com/RichardBronosky/… and will create my own answer if you revert/reject it.

                          – Bruno Bronosky
                          Jul 15 '18 at 5:00











                        • Update: It feels slimy to copy pasta this answer and make subtle changes to it, but my edit got rejected. I hope you feel like I maintained the integrity of your answer in mine.

                          – Bruno Bronosky
                          Jul 18 '18 at 5:47













                        • Feel free to edit or hack; anything that makes it better for you, (that's why I added MIT Licence! I don't even need credit.)

                          – Alexx Roche
                          Jul 30 '18 at 11:41














                        • 1





                          Alexx, I love this answer. I hope you don't mind my edit. I made it also work for files that are not installed on the system. I made a backup at gist.github.com/RichardBronosky/… and will create my own answer if you revert/reject it.

                          – Bruno Bronosky
                          Jul 15 '18 at 5:00











                        • Update: It feels slimy to copy pasta this answer and make subtle changes to it, but my edit got rejected. I hope you feel like I maintained the integrity of your answer in mine.

                          – Bruno Bronosky
                          Jul 18 '18 at 5:47













                        • Feel free to edit or hack; anything that makes it better for you, (that's why I added MIT Licence! I don't even need credit.)

                          – Alexx Roche
                          Jul 30 '18 at 11:41








                        1




                        1





                        Alexx, I love this answer. I hope you don't mind my edit. I made it also work for files that are not installed on the system. I made a backup at gist.github.com/RichardBronosky/… and will create my own answer if you revert/reject it.

                        – Bruno Bronosky
                        Jul 15 '18 at 5:00





                        Alexx, I love this answer. I hope you don't mind my edit. I made it also work for files that are not installed on the system. I made a backup at gist.github.com/RichardBronosky/… and will create my own answer if you revert/reject it.

                        – Bruno Bronosky
                        Jul 15 '18 at 5:00













                        Update: It feels slimy to copy pasta this answer and make subtle changes to it, but my edit got rejected. I hope you feel like I maintained the integrity of your answer in mine.

                        – Bruno Bronosky
                        Jul 18 '18 at 5:47







                        Update: It feels slimy to copy pasta this answer and make subtle changes to it, but my edit got rejected. I hope you feel like I maintained the integrity of your answer in mine.

                        – Bruno Bronosky
                        Jul 18 '18 at 5:47















                        Feel free to edit or hack; anything that makes it better for you, (that's why I added MIT Licence! I don't even need credit.)

                        – Alexx Roche
                        Jul 30 '18 at 11:41





                        Feel free to edit or hack; anything that makes it better for you, (that's why I added MIT Licence! I don't even need credit.)

                        – Alexx Roche
                        Jul 30 '18 at 11:41











                        3














                        This is an extension to Alexx Roche's excellent answer. I tried to make an edit to that answer, but it got rejected (though not by Alexx)





                        I was trying to track down what installed which on my system. After a little work I created /usr/local/bin/apt-whatprovides



                        #!/bin/sh
                        #apt-whatprovides ver. 201801010101 Copyright alexx, MIT Licence
                        #rdfa:deps="[realpath,apt-file,grep,which,sh,echo]"

                        BINARY="$(realpath $(which $@) 2>/dev/null)"
                        [ -z "$BINARY" ] && BINARY="$@"
                        echo Searching for $BINARY
                        PACKAGE="$(apt-file search $BINARY|grep -E ":.*[^-.a-zA-Z0-9]${BINARY}$")"
                        echo "${PACKAGE}"


                        Though for most THINGs that are installed you can just use:



                        apt-file search $(realpath $(which THING)) | grep 'THING$'


                        For THINGs that are not installed, you can use:



                        apt-file search THING | grep '/THING$'


                        The apt-whatprovides script works for files that are and are not on your system. For example, my system lacked dig but had ping so this it what resulted:



                        pi@raspberrypi:~ $ apt-whatprovides ping
                        Searching for /bin/ping
                        inetutils-ping: /bin/ping
                        iputils-ping: /bin/ping

                        pi@raspberrypi:~ $ apt-whatprovides dig
                        Searching for dig
                        dnsutils: /usr/bin/dig
                        epic4: /usr/share/epic4/script/dig
                        epic4-help: /usr/share/epic4/help/8_Scripts/dig
                        knot-dnsutils: /usr/bin/dig


                        Notice that Searching for is a complete path for ping (installed) and just the binary name for dig not installed. This helped me discover that I needed to install dnsutils without needing to go search https://packages.ubuntu.com/#search_contents






                        share|improve this answer


























                        • This is such a good answer that I should delete mine!

                          – Alexx Roche
                          Jul 30 '18 at 11:49
















                        3














                        This is an extension to Alexx Roche's excellent answer. I tried to make an edit to that answer, but it got rejected (though not by Alexx)





                        I was trying to track down what installed which on my system. After a little work I created /usr/local/bin/apt-whatprovides



                        #!/bin/sh
                        #apt-whatprovides ver. 201801010101 Copyright alexx, MIT Licence
                        #rdfa:deps="[realpath,apt-file,grep,which,sh,echo]"

                        BINARY="$(realpath $(which $@) 2>/dev/null)"
                        [ -z "$BINARY" ] && BINARY="$@"
                        echo Searching for $BINARY
                        PACKAGE="$(apt-file search $BINARY|grep -E ":.*[^-.a-zA-Z0-9]${BINARY}$")"
                        echo "${PACKAGE}"


                        Though for most THINGs that are installed you can just use:



                        apt-file search $(realpath $(which THING)) | grep 'THING$'


                        For THINGs that are not installed, you can use:



                        apt-file search THING | grep '/THING$'


                        The apt-whatprovides script works for files that are and are not on your system. For example, my system lacked dig but had ping so this it what resulted:



                        pi@raspberrypi:~ $ apt-whatprovides ping
                        Searching for /bin/ping
                        inetutils-ping: /bin/ping
                        iputils-ping: /bin/ping

                        pi@raspberrypi:~ $ apt-whatprovides dig
                        Searching for dig
                        dnsutils: /usr/bin/dig
                        epic4: /usr/share/epic4/script/dig
                        epic4-help: /usr/share/epic4/help/8_Scripts/dig
                        knot-dnsutils: /usr/bin/dig


                        Notice that Searching for is a complete path for ping (installed) and just the binary name for dig not installed. This helped me discover that I needed to install dnsutils without needing to go search https://packages.ubuntu.com/#search_contents






                        share|improve this answer


























                        • This is such a good answer that I should delete mine!

                          – Alexx Roche
                          Jul 30 '18 at 11:49














                        3












                        3








                        3







                        This is an extension to Alexx Roche's excellent answer. I tried to make an edit to that answer, but it got rejected (though not by Alexx)





                        I was trying to track down what installed which on my system. After a little work I created /usr/local/bin/apt-whatprovides



                        #!/bin/sh
                        #apt-whatprovides ver. 201801010101 Copyright alexx, MIT Licence
                        #rdfa:deps="[realpath,apt-file,grep,which,sh,echo]"

                        BINARY="$(realpath $(which $@) 2>/dev/null)"
                        [ -z "$BINARY" ] && BINARY="$@"
                        echo Searching for $BINARY
                        PACKAGE="$(apt-file search $BINARY|grep -E ":.*[^-.a-zA-Z0-9]${BINARY}$")"
                        echo "${PACKAGE}"


                        Though for most THINGs that are installed you can just use:



                        apt-file search $(realpath $(which THING)) | grep 'THING$'


                        For THINGs that are not installed, you can use:



                        apt-file search THING | grep '/THING$'


                        The apt-whatprovides script works for files that are and are not on your system. For example, my system lacked dig but had ping so this it what resulted:



                        pi@raspberrypi:~ $ apt-whatprovides ping
                        Searching for /bin/ping
                        inetutils-ping: /bin/ping
                        iputils-ping: /bin/ping

                        pi@raspberrypi:~ $ apt-whatprovides dig
                        Searching for dig
                        dnsutils: /usr/bin/dig
                        epic4: /usr/share/epic4/script/dig
                        epic4-help: /usr/share/epic4/help/8_Scripts/dig
                        knot-dnsutils: /usr/bin/dig


                        Notice that Searching for is a complete path for ping (installed) and just the binary name for dig not installed. This helped me discover that I needed to install dnsutils without needing to go search https://packages.ubuntu.com/#search_contents






                        share|improve this answer















                        This is an extension to Alexx Roche's excellent answer. I tried to make an edit to that answer, but it got rejected (though not by Alexx)





                        I was trying to track down what installed which on my system. After a little work I created /usr/local/bin/apt-whatprovides



                        #!/bin/sh
                        #apt-whatprovides ver. 201801010101 Copyright alexx, MIT Licence
                        #rdfa:deps="[realpath,apt-file,grep,which,sh,echo]"

                        BINARY="$(realpath $(which $@) 2>/dev/null)"
                        [ -z "$BINARY" ] && BINARY="$@"
                        echo Searching for $BINARY
                        PACKAGE="$(apt-file search $BINARY|grep -E ":.*[^-.a-zA-Z0-9]${BINARY}$")"
                        echo "${PACKAGE}"


                        Though for most THINGs that are installed you can just use:



                        apt-file search $(realpath $(which THING)) | grep 'THING$'


                        For THINGs that are not installed, you can use:



                        apt-file search THING | grep '/THING$'


                        The apt-whatprovides script works for files that are and are not on your system. For example, my system lacked dig but had ping so this it what resulted:



                        pi@raspberrypi:~ $ apt-whatprovides ping
                        Searching for /bin/ping
                        inetutils-ping: /bin/ping
                        iputils-ping: /bin/ping

                        pi@raspberrypi:~ $ apt-whatprovides dig
                        Searching for dig
                        dnsutils: /usr/bin/dig
                        epic4: /usr/share/epic4/script/dig
                        epic4-help: /usr/share/epic4/help/8_Scripts/dig
                        knot-dnsutils: /usr/bin/dig


                        Notice that Searching for is a complete path for ping (installed) and just the binary name for dig not installed. This helped me discover that I needed to install dnsutils without needing to go search https://packages.ubuntu.com/#search_contents







                        share|improve this answer














                        share|improve this answer



                        share|improve this answer








                        edited Jul 18 '18 at 8:16

























                        answered Jul 18 '18 at 5:45









                        Bruno BronoskyBruno Bronosky

                        50349




                        50349













                        • This is such a good answer that I should delete mine!

                          – Alexx Roche
                          Jul 30 '18 at 11:49



















                        • This is such a good answer that I should delete mine!

                          – Alexx Roche
                          Jul 30 '18 at 11:49

















                        This is such a good answer that I should delete mine!

                        – Alexx Roche
                        Jul 30 '18 at 11:49





                        This is such a good answer that I should delete mine!

                        – Alexx Roche
                        Jul 30 '18 at 11:49











                        2














                        One reason you might have to do this is if you are compiling software which there already is an ubuntu package, you can run apt-get build-dep $PACKAGENAME. That will install all packages you need to compile $PACKAGENAME.






                        share|improve this answer




























                          2














                          One reason you might have to do this is if you are compiling software which there already is an ubuntu package, you can run apt-get build-dep $PACKAGENAME. That will install all packages you need to compile $PACKAGENAME.






                          share|improve this answer


























                            2












                            2








                            2







                            One reason you might have to do this is if you are compiling software which there already is an ubuntu package, you can run apt-get build-dep $PACKAGENAME. That will install all packages you need to compile $PACKAGENAME.






                            share|improve this answer













                            One reason you might have to do this is if you are compiling software which there already is an ubuntu package, you can run apt-get build-dep $PACKAGENAME. That will install all packages you need to compile $PACKAGENAME.







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Aug 11 '10 at 19:31









                            RoryRory

                            1,24721323




                            1,24721323






























                                draft saved

                                draft discarded




















































                                Thanks for contributing an answer to Ask Ubuntu!


                                • 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%2faskubuntu.com%2fquestions%2f481%2fhow-do-i-find-the-package-that-provides-a-file%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

                                GameSpot

                                connect to host localhost port 22: Connection refused

                                Getting a Wifi WPA2 wifi connection