How can I list all files which will be installed by an APT package?











up vote
0
down vote

favorite
1












This is similar to How can I list all files which have been installed by an APT package? However, I want to know which files will be installed as the package has not been installed, yet.



Example: I wanted to list all files which will be installed by APT package xorg. In other words: all files which will possibly be created when I type apt install xorg. However, apt-file listed only the immediate files of xorg - not of its dependencies:



$ apt-file list xorg
xorg: /usr/share/bug/xorg/script
xorg: /usr/share/doc/xorg/changelog.gz
xorg: /usr/share/doc/xorg/copyright
xorg: /usr/share/lintian/overrides/xorg


How can I list all associated files?



(I will add an awful bash pipe combination as an answer. This is what I'm using right now, but its just a loop with many calls to apt-file and therefore very, very slow. I'm looking for a better answer.)










share|improve this question




























    up vote
    0
    down vote

    favorite
    1












    This is similar to How can I list all files which have been installed by an APT package? However, I want to know which files will be installed as the package has not been installed, yet.



    Example: I wanted to list all files which will be installed by APT package xorg. In other words: all files which will possibly be created when I type apt install xorg. However, apt-file listed only the immediate files of xorg - not of its dependencies:



    $ apt-file list xorg
    xorg: /usr/share/bug/xorg/script
    xorg: /usr/share/doc/xorg/changelog.gz
    xorg: /usr/share/doc/xorg/copyright
    xorg: /usr/share/lintian/overrides/xorg


    How can I list all associated files?



    (I will add an awful bash pipe combination as an answer. This is what I'm using right now, but its just a loop with many calls to apt-file and therefore very, very slow. I'm looking for a better answer.)










    share|improve this question


























      up vote
      0
      down vote

      favorite
      1









      up vote
      0
      down vote

      favorite
      1






      1





      This is similar to How can I list all files which have been installed by an APT package? However, I want to know which files will be installed as the package has not been installed, yet.



      Example: I wanted to list all files which will be installed by APT package xorg. In other words: all files which will possibly be created when I type apt install xorg. However, apt-file listed only the immediate files of xorg - not of its dependencies:



      $ apt-file list xorg
      xorg: /usr/share/bug/xorg/script
      xorg: /usr/share/doc/xorg/changelog.gz
      xorg: /usr/share/doc/xorg/copyright
      xorg: /usr/share/lintian/overrides/xorg


      How can I list all associated files?



      (I will add an awful bash pipe combination as an answer. This is what I'm using right now, but its just a loop with many calls to apt-file and therefore very, very slow. I'm looking for a better answer.)










      share|improve this question















      This is similar to How can I list all files which have been installed by an APT package? However, I want to know which files will be installed as the package has not been installed, yet.



      Example: I wanted to list all files which will be installed by APT package xorg. In other words: all files which will possibly be created when I type apt install xorg. However, apt-file listed only the immediate files of xorg - not of its dependencies:



      $ apt-file list xorg
      xorg: /usr/share/bug/xorg/script
      xorg: /usr/share/doc/xorg/changelog.gz
      xorg: /usr/share/doc/xorg/copyright
      xorg: /usr/share/lintian/overrides/xorg


      How can I list all associated files?



      (I will add an awful bash pipe combination as an answer. This is what I'm using right now, but its just a loop with many calls to apt-file and therefore very, very slow. I'm looking for a better answer.)







      bash shell-script debian ubuntu apt






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 2 days ago

























      asked Jun 21 at 0:11









      Jayjayyy

      1758




      1758






















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          1
          down vote













          This is what I'm using right now, but it might be buggy and is definitely not very performant:



          apt-cache depends xorg | grep '..(Depends|Recommends): [^<]' | sed 's/[^:]*: //' | while read LINE; do [[ -z "$LINE" ]] || apt-file list "$LINE"; done | sed 's/[^:]*: //' | sort




          Step-by-step:



          Get list of packages which will be installed:



          apt-cache depends xorg


          Select the "depends" and "recommends" entries:



          grep '..(Depends|Recommends): [^<]'


          Strip everything except the package name:



          sed 's/[^:]*: //'


          If the line isn't empty, run apt-file with each package name:



          while read LINE; do [[ -z "$LINE" ]] || apt-file list "$LINE"; done


          apt-file list returns lines where each line begins with the corresponding package name for the file. Remove package name from line, which leaves only the filename:



          sed 's/[^:]*: //'


          Sort lines:



          sort





          share|improve this answer




























            up vote
            1
            down vote













            You can feed apt-file list a list of packages to process in one go, using



            apt-file -f-


            (to read from standard input). My measurements suggest that



            apt-get -s install xorg | awk '/^Inst / { print $2 }' | apt-file -f- list


            is over twice as fast as the same process with an apt-file loop (using xargs).



            I post-process that with sort -k2,2 since I quite like to see the package involved.



            Using apt-get -s install instead of post-processing apt-cache depends xorg means that all the packages which would be installed on your system are taken into account, and only those packages, including recursive dependencies. apt-cache depends xorg only shows xorg’s immediate dependencies and your post-processing doesn’t handle alternatives.






            share|improve this answer





















              Your Answer








              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "106"
              };
              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: false,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              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%2funix.stackexchange.com%2fquestions%2f450999%2fhow-can-i-list-all-files-which-will-be-installed-by-an-apt-package%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes








              up vote
              1
              down vote













              This is what I'm using right now, but it might be buggy and is definitely not very performant:



              apt-cache depends xorg | grep '..(Depends|Recommends): [^<]' | sed 's/[^:]*: //' | while read LINE; do [[ -z "$LINE" ]] || apt-file list "$LINE"; done | sed 's/[^:]*: //' | sort




              Step-by-step:



              Get list of packages which will be installed:



              apt-cache depends xorg


              Select the "depends" and "recommends" entries:



              grep '..(Depends|Recommends): [^<]'


              Strip everything except the package name:



              sed 's/[^:]*: //'


              If the line isn't empty, run apt-file with each package name:



              while read LINE; do [[ -z "$LINE" ]] || apt-file list "$LINE"; done


              apt-file list returns lines where each line begins with the corresponding package name for the file. Remove package name from line, which leaves only the filename:



              sed 's/[^:]*: //'


              Sort lines:



              sort





              share|improve this answer

























                up vote
                1
                down vote













                This is what I'm using right now, but it might be buggy and is definitely not very performant:



                apt-cache depends xorg | grep '..(Depends|Recommends): [^<]' | sed 's/[^:]*: //' | while read LINE; do [[ -z "$LINE" ]] || apt-file list "$LINE"; done | sed 's/[^:]*: //' | sort




                Step-by-step:



                Get list of packages which will be installed:



                apt-cache depends xorg


                Select the "depends" and "recommends" entries:



                grep '..(Depends|Recommends): [^<]'


                Strip everything except the package name:



                sed 's/[^:]*: //'


                If the line isn't empty, run apt-file with each package name:



                while read LINE; do [[ -z "$LINE" ]] || apt-file list "$LINE"; done


                apt-file list returns lines where each line begins with the corresponding package name for the file. Remove package name from line, which leaves only the filename:



                sed 's/[^:]*: //'


                Sort lines:



                sort





                share|improve this answer























                  up vote
                  1
                  down vote










                  up vote
                  1
                  down vote









                  This is what I'm using right now, but it might be buggy and is definitely not very performant:



                  apt-cache depends xorg | grep '..(Depends|Recommends): [^<]' | sed 's/[^:]*: //' | while read LINE; do [[ -z "$LINE" ]] || apt-file list "$LINE"; done | sed 's/[^:]*: //' | sort




                  Step-by-step:



                  Get list of packages which will be installed:



                  apt-cache depends xorg


                  Select the "depends" and "recommends" entries:



                  grep '..(Depends|Recommends): [^<]'


                  Strip everything except the package name:



                  sed 's/[^:]*: //'


                  If the line isn't empty, run apt-file with each package name:



                  while read LINE; do [[ -z "$LINE" ]] || apt-file list "$LINE"; done


                  apt-file list returns lines where each line begins with the corresponding package name for the file. Remove package name from line, which leaves only the filename:



                  sed 's/[^:]*: //'


                  Sort lines:



                  sort





                  share|improve this answer












                  This is what I'm using right now, but it might be buggy and is definitely not very performant:



                  apt-cache depends xorg | grep '..(Depends|Recommends): [^<]' | sed 's/[^:]*: //' | while read LINE; do [[ -z "$LINE" ]] || apt-file list "$LINE"; done | sed 's/[^:]*: //' | sort




                  Step-by-step:



                  Get list of packages which will be installed:



                  apt-cache depends xorg


                  Select the "depends" and "recommends" entries:



                  grep '..(Depends|Recommends): [^<]'


                  Strip everything except the package name:



                  sed 's/[^:]*: //'


                  If the line isn't empty, run apt-file with each package name:



                  while read LINE; do [[ -z "$LINE" ]] || apt-file list "$LINE"; done


                  apt-file list returns lines where each line begins with the corresponding package name for the file. Remove package name from line, which leaves only the filename:



                  sed 's/[^:]*: //'


                  Sort lines:



                  sort






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jun 21 at 0:12









                  Jayjayyy

                  1758




                  1758
























                      up vote
                      1
                      down vote













                      You can feed apt-file list a list of packages to process in one go, using



                      apt-file -f-


                      (to read from standard input). My measurements suggest that



                      apt-get -s install xorg | awk '/^Inst / { print $2 }' | apt-file -f- list


                      is over twice as fast as the same process with an apt-file loop (using xargs).



                      I post-process that with sort -k2,2 since I quite like to see the package involved.



                      Using apt-get -s install instead of post-processing apt-cache depends xorg means that all the packages which would be installed on your system are taken into account, and only those packages, including recursive dependencies. apt-cache depends xorg only shows xorg’s immediate dependencies and your post-processing doesn’t handle alternatives.






                      share|improve this answer

























                        up vote
                        1
                        down vote













                        You can feed apt-file list a list of packages to process in one go, using



                        apt-file -f-


                        (to read from standard input). My measurements suggest that



                        apt-get -s install xorg | awk '/^Inst / { print $2 }' | apt-file -f- list


                        is over twice as fast as the same process with an apt-file loop (using xargs).



                        I post-process that with sort -k2,2 since I quite like to see the package involved.



                        Using apt-get -s install instead of post-processing apt-cache depends xorg means that all the packages which would be installed on your system are taken into account, and only those packages, including recursive dependencies. apt-cache depends xorg only shows xorg’s immediate dependencies and your post-processing doesn’t handle alternatives.






                        share|improve this answer























                          up vote
                          1
                          down vote










                          up vote
                          1
                          down vote









                          You can feed apt-file list a list of packages to process in one go, using



                          apt-file -f-


                          (to read from standard input). My measurements suggest that



                          apt-get -s install xorg | awk '/^Inst / { print $2 }' | apt-file -f- list


                          is over twice as fast as the same process with an apt-file loop (using xargs).



                          I post-process that with sort -k2,2 since I quite like to see the package involved.



                          Using apt-get -s install instead of post-processing apt-cache depends xorg means that all the packages which would be installed on your system are taken into account, and only those packages, including recursive dependencies. apt-cache depends xorg only shows xorg’s immediate dependencies and your post-processing doesn’t handle alternatives.






                          share|improve this answer












                          You can feed apt-file list a list of packages to process in one go, using



                          apt-file -f-


                          (to read from standard input). My measurements suggest that



                          apt-get -s install xorg | awk '/^Inst / { print $2 }' | apt-file -f- list


                          is over twice as fast as the same process with an apt-file loop (using xargs).



                          I post-process that with sort -k2,2 since I quite like to see the package involved.



                          Using apt-get -s install instead of post-processing apt-cache depends xorg means that all the packages which would be installed on your system are taken into account, and only those packages, including recursive dependencies. apt-cache depends xorg only shows xorg’s immediate dependencies and your post-processing doesn’t handle alternatives.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered 2 days ago









                          Stephen Kitt

                          161k24357433




                          161k24357433






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Unix & Linux Stack Exchange!


                              • 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%2funix.stackexchange.com%2fquestions%2f450999%2fhow-can-i-list-all-files-which-will-be-installed-by-an-apt-package%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

                              サソリ

                              広島県道265号伴広島線

                              Setup Asymptote in Texstudio