Make “apt-get update” show the exact output as `apt update`












4















I'm learning the CLI interface of Advanced Packaging Tool. From the output of apt(8) when its stdout isn't a terminal, it isn't suitable for "scripts expecting stable programming interface", so I'm taking a look at apt-get(8).



One difference between apt update and apt-get update is that the latter is missing a final line after all cache has been updated:



8 packages can be upgraded. Run 'apt list --upgradable' to see them.


I want to know how I can get this exact line displayed with apt-get(8).










share|improve this question





























    4















    I'm learning the CLI interface of Advanced Packaging Tool. From the output of apt(8) when its stdout isn't a terminal, it isn't suitable for "scripts expecting stable programming interface", so I'm taking a look at apt-get(8).



    One difference between apt update and apt-get update is that the latter is missing a final line after all cache has been updated:



    8 packages can be upgraded. Run 'apt list --upgradable' to see them.


    I want to know how I can get this exact line displayed with apt-get(8).










    share|improve this question



























      4












      4








      4








      I'm learning the CLI interface of Advanced Packaging Tool. From the output of apt(8) when its stdout isn't a terminal, it isn't suitable for "scripts expecting stable programming interface", so I'm taking a look at apt-get(8).



      One difference between apt update and apt-get update is that the latter is missing a final line after all cache has been updated:



      8 packages can be upgraded. Run 'apt list --upgradable' to see them.


      I want to know how I can get this exact line displayed with apt-get(8).










      share|improve this question
















      I'm learning the CLI interface of Advanced Packaging Tool. From the output of apt(8) when its stdout isn't a terminal, it isn't suitable for "scripts expecting stable programming interface", so I'm taking a look at apt-get(8).



      One difference between apt update and apt-get update is that the latter is missing a final line after all cache has been updated:



      8 packages can be upgraded. Run 'apt list --upgradable' to see them.


      I want to know how I can get this exact line displayed with apt-get(8).







      apt






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 2 hours ago







      iBug

















      asked 2 hours ago









      iBugiBug

      1441212




      1441212






















          3 Answers
          3






          active

          oldest

          votes


















          3














          man apt-get shows:



             -s, --simulate, --just-print, --dry-run, --recon, --no-act
          No action; perform a simulation of events that would occur based on
          the current system state but do not actually change the system.
          Locking will be disabled (Debug::NoLocking) so the system state
          could change while apt-get is running. Simulations can also be
          executed by non-root users which might not have read access to all
          apt configuration distorting the simulation. A notice expressing
          this warning is also shown by default for non-root users
          (APT::Get::Show-User-Simulation-Note). Configuration Item:
          APT::Get::Simulate.


          So if you just do:



          apt-get upgrade --dry-run



          it will output:



          ...
          4 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.
          ...





          share|improve this answer
























          • Yeah, I went through man 8 apt-get and found that option, but the output was different from apt.

            – iBug
            2 hours ago











          • Different how? I just checked on my system and it's identical. I thought it was identical because apt is really a programmatic wrapper around apt-get and that's the reason why the warning exists.

            – tudor
            2 hours ago











          • apt shows 8 packages can be upgraded. Run 'apt list --upgradable' to see them., while your answer shows 4 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.

            – iBug
            2 hours ago











          • Yes, that's because you have 8 to upgrade where I have 4. Or are you referring to the text being different?

            – tudor
            2 hours ago











          • I'm talking about text being different, even after normalizing variables into %d. But +1 for a decent answer anyways.

            – iBug
            1 hour ago





















          3














          Guessing you need to handle the number of available updates, here is a suggestion:



          # With no option, returns two numbers, no CR nor LF
          /usr/lib/update-notifier/apt-check

          # With --human-readable, returns numbers, locale LANG text & CR/LF
          /usr/lib/update-notifier/apt-check --human-readable


          No need to sudo

          The output is easy to work with



          More options:



          > /usr/lib/update-notifier/apt-check  --help
          Usage: apt-check [options]

          Options:
          -h, --help show this help message and exit
          -p, --package-names Show the packages that are going to be
          installed/upgraded
          --human-readable Show human readable output on stdout
          --security-updates-unattended
          Return the time in days when security updates are
          installed unattended (0 means disabled)





          share|improve this answer
























          • Is this the exact thing used to generate motd on SSH login?

            – iBug
            1 hour ago













          • yes it looks like the same output, but i dunno how does motd

            – cmak.fr
            1 hour ago



















          0














          From man 8 apt:




          ... enables some options ...




          Then I went through /usr/share/doc/apt/examples/configure-index.gz (using zcat(1) to show text content) and noticed this option:



          apt::cmd::show-update-stats


          So I worked out the following command that did exactly what I wanted:



          # apt-get -o apt::cmd::show-update-stats=true update


          Tested to be working on Xenial and Bionic.






          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%2f1128447%2fmake-apt-get-update-show-the-exact-output-as-apt-update%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            3 Answers
            3






            active

            oldest

            votes








            3 Answers
            3






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            3














            man apt-get shows:



               -s, --simulate, --just-print, --dry-run, --recon, --no-act
            No action; perform a simulation of events that would occur based on
            the current system state but do not actually change the system.
            Locking will be disabled (Debug::NoLocking) so the system state
            could change while apt-get is running. Simulations can also be
            executed by non-root users which might not have read access to all
            apt configuration distorting the simulation. A notice expressing
            this warning is also shown by default for non-root users
            (APT::Get::Show-User-Simulation-Note). Configuration Item:
            APT::Get::Simulate.


            So if you just do:



            apt-get upgrade --dry-run



            it will output:



            ...
            4 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.
            ...





            share|improve this answer
























            • Yeah, I went through man 8 apt-get and found that option, but the output was different from apt.

              – iBug
              2 hours ago











            • Different how? I just checked on my system and it's identical. I thought it was identical because apt is really a programmatic wrapper around apt-get and that's the reason why the warning exists.

              – tudor
              2 hours ago











            • apt shows 8 packages can be upgraded. Run 'apt list --upgradable' to see them., while your answer shows 4 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.

              – iBug
              2 hours ago











            • Yes, that's because you have 8 to upgrade where I have 4. Or are you referring to the text being different?

              – tudor
              2 hours ago











            • I'm talking about text being different, even after normalizing variables into %d. But +1 for a decent answer anyways.

              – iBug
              1 hour ago


















            3














            man apt-get shows:



               -s, --simulate, --just-print, --dry-run, --recon, --no-act
            No action; perform a simulation of events that would occur based on
            the current system state but do not actually change the system.
            Locking will be disabled (Debug::NoLocking) so the system state
            could change while apt-get is running. Simulations can also be
            executed by non-root users which might not have read access to all
            apt configuration distorting the simulation. A notice expressing
            this warning is also shown by default for non-root users
            (APT::Get::Show-User-Simulation-Note). Configuration Item:
            APT::Get::Simulate.


            So if you just do:



            apt-get upgrade --dry-run



            it will output:



            ...
            4 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.
            ...





            share|improve this answer
























            • Yeah, I went through man 8 apt-get and found that option, but the output was different from apt.

              – iBug
              2 hours ago











            • Different how? I just checked on my system and it's identical. I thought it was identical because apt is really a programmatic wrapper around apt-get and that's the reason why the warning exists.

              – tudor
              2 hours ago











            • apt shows 8 packages can be upgraded. Run 'apt list --upgradable' to see them., while your answer shows 4 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.

              – iBug
              2 hours ago











            • Yes, that's because you have 8 to upgrade where I have 4. Or are you referring to the text being different?

              – tudor
              2 hours ago











            • I'm talking about text being different, even after normalizing variables into %d. But +1 for a decent answer anyways.

              – iBug
              1 hour ago
















            3












            3








            3







            man apt-get shows:



               -s, --simulate, --just-print, --dry-run, --recon, --no-act
            No action; perform a simulation of events that would occur based on
            the current system state but do not actually change the system.
            Locking will be disabled (Debug::NoLocking) so the system state
            could change while apt-get is running. Simulations can also be
            executed by non-root users which might not have read access to all
            apt configuration distorting the simulation. A notice expressing
            this warning is also shown by default for non-root users
            (APT::Get::Show-User-Simulation-Note). Configuration Item:
            APT::Get::Simulate.


            So if you just do:



            apt-get upgrade --dry-run



            it will output:



            ...
            4 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.
            ...





            share|improve this answer













            man apt-get shows:



               -s, --simulate, --just-print, --dry-run, --recon, --no-act
            No action; perform a simulation of events that would occur based on
            the current system state but do not actually change the system.
            Locking will be disabled (Debug::NoLocking) so the system state
            could change while apt-get is running. Simulations can also be
            executed by non-root users which might not have read access to all
            apt configuration distorting the simulation. A notice expressing
            this warning is also shown by default for non-root users
            (APT::Get::Show-User-Simulation-Note). Configuration Item:
            APT::Get::Simulate.


            So if you just do:



            apt-get upgrade --dry-run



            it will output:



            ...
            4 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.
            ...






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered 2 hours ago









            tudortudor

            3,00651948




            3,00651948













            • Yeah, I went through man 8 apt-get and found that option, but the output was different from apt.

              – iBug
              2 hours ago











            • Different how? I just checked on my system and it's identical. I thought it was identical because apt is really a programmatic wrapper around apt-get and that's the reason why the warning exists.

              – tudor
              2 hours ago











            • apt shows 8 packages can be upgraded. Run 'apt list --upgradable' to see them., while your answer shows 4 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.

              – iBug
              2 hours ago











            • Yes, that's because you have 8 to upgrade where I have 4. Or are you referring to the text being different?

              – tudor
              2 hours ago











            • I'm talking about text being different, even after normalizing variables into %d. But +1 for a decent answer anyways.

              – iBug
              1 hour ago





















            • Yeah, I went through man 8 apt-get and found that option, but the output was different from apt.

              – iBug
              2 hours ago











            • Different how? I just checked on my system and it's identical. I thought it was identical because apt is really a programmatic wrapper around apt-get and that's the reason why the warning exists.

              – tudor
              2 hours ago











            • apt shows 8 packages can be upgraded. Run 'apt list --upgradable' to see them., while your answer shows 4 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.

              – iBug
              2 hours ago











            • Yes, that's because you have 8 to upgrade where I have 4. Or are you referring to the text being different?

              – tudor
              2 hours ago











            • I'm talking about text being different, even after normalizing variables into %d. But +1 for a decent answer anyways.

              – iBug
              1 hour ago



















            Yeah, I went through man 8 apt-get and found that option, but the output was different from apt.

            – iBug
            2 hours ago





            Yeah, I went through man 8 apt-get and found that option, but the output was different from apt.

            – iBug
            2 hours ago













            Different how? I just checked on my system and it's identical. I thought it was identical because apt is really a programmatic wrapper around apt-get and that's the reason why the warning exists.

            – tudor
            2 hours ago





            Different how? I just checked on my system and it's identical. I thought it was identical because apt is really a programmatic wrapper around apt-get and that's the reason why the warning exists.

            – tudor
            2 hours ago













            apt shows 8 packages can be upgraded. Run 'apt list --upgradable' to see them., while your answer shows 4 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.

            – iBug
            2 hours ago





            apt shows 8 packages can be upgraded. Run 'apt list --upgradable' to see them., while your answer shows 4 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.

            – iBug
            2 hours ago













            Yes, that's because you have 8 to upgrade where I have 4. Or are you referring to the text being different?

            – tudor
            2 hours ago





            Yes, that's because you have 8 to upgrade where I have 4. Or are you referring to the text being different?

            – tudor
            2 hours ago













            I'm talking about text being different, even after normalizing variables into %d. But +1 for a decent answer anyways.

            – iBug
            1 hour ago







            I'm talking about text being different, even after normalizing variables into %d. But +1 for a decent answer anyways.

            – iBug
            1 hour ago















            3














            Guessing you need to handle the number of available updates, here is a suggestion:



            # With no option, returns two numbers, no CR nor LF
            /usr/lib/update-notifier/apt-check

            # With --human-readable, returns numbers, locale LANG text & CR/LF
            /usr/lib/update-notifier/apt-check --human-readable


            No need to sudo

            The output is easy to work with



            More options:



            > /usr/lib/update-notifier/apt-check  --help
            Usage: apt-check [options]

            Options:
            -h, --help show this help message and exit
            -p, --package-names Show the packages that are going to be
            installed/upgraded
            --human-readable Show human readable output on stdout
            --security-updates-unattended
            Return the time in days when security updates are
            installed unattended (0 means disabled)





            share|improve this answer
























            • Is this the exact thing used to generate motd on SSH login?

              – iBug
              1 hour ago













            • yes it looks like the same output, but i dunno how does motd

              – cmak.fr
              1 hour ago
















            3














            Guessing you need to handle the number of available updates, here is a suggestion:



            # With no option, returns two numbers, no CR nor LF
            /usr/lib/update-notifier/apt-check

            # With --human-readable, returns numbers, locale LANG text & CR/LF
            /usr/lib/update-notifier/apt-check --human-readable


            No need to sudo

            The output is easy to work with



            More options:



            > /usr/lib/update-notifier/apt-check  --help
            Usage: apt-check [options]

            Options:
            -h, --help show this help message and exit
            -p, --package-names Show the packages that are going to be
            installed/upgraded
            --human-readable Show human readable output on stdout
            --security-updates-unattended
            Return the time in days when security updates are
            installed unattended (0 means disabled)





            share|improve this answer
























            • Is this the exact thing used to generate motd on SSH login?

              – iBug
              1 hour ago













            • yes it looks like the same output, but i dunno how does motd

              – cmak.fr
              1 hour ago














            3












            3








            3







            Guessing you need to handle the number of available updates, here is a suggestion:



            # With no option, returns two numbers, no CR nor LF
            /usr/lib/update-notifier/apt-check

            # With --human-readable, returns numbers, locale LANG text & CR/LF
            /usr/lib/update-notifier/apt-check --human-readable


            No need to sudo

            The output is easy to work with



            More options:



            > /usr/lib/update-notifier/apt-check  --help
            Usage: apt-check [options]

            Options:
            -h, --help show this help message and exit
            -p, --package-names Show the packages that are going to be
            installed/upgraded
            --human-readable Show human readable output on stdout
            --security-updates-unattended
            Return the time in days when security updates are
            installed unattended (0 means disabled)





            share|improve this answer













            Guessing you need to handle the number of available updates, here is a suggestion:



            # With no option, returns two numbers, no CR nor LF
            /usr/lib/update-notifier/apt-check

            # With --human-readable, returns numbers, locale LANG text & CR/LF
            /usr/lib/update-notifier/apt-check --human-readable


            No need to sudo

            The output is easy to work with



            More options:



            > /usr/lib/update-notifier/apt-check  --help
            Usage: apt-check [options]

            Options:
            -h, --help show this help message and exit
            -p, --package-names Show the packages that are going to be
            installed/upgraded
            --human-readable Show human readable output on stdout
            --security-updates-unattended
            Return the time in days when security updates are
            installed unattended (0 means disabled)






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered 1 hour ago









            cmak.frcmak.fr

            2,3241121




            2,3241121













            • Is this the exact thing used to generate motd on SSH login?

              – iBug
              1 hour ago













            • yes it looks like the same output, but i dunno how does motd

              – cmak.fr
              1 hour ago



















            • Is this the exact thing used to generate motd on SSH login?

              – iBug
              1 hour ago













            • yes it looks like the same output, but i dunno how does motd

              – cmak.fr
              1 hour ago

















            Is this the exact thing used to generate motd on SSH login?

            – iBug
            1 hour ago







            Is this the exact thing used to generate motd on SSH login?

            – iBug
            1 hour ago















            yes it looks like the same output, but i dunno how does motd

            – cmak.fr
            1 hour ago





            yes it looks like the same output, but i dunno how does motd

            – cmak.fr
            1 hour ago











            0














            From man 8 apt:




            ... enables some options ...




            Then I went through /usr/share/doc/apt/examples/configure-index.gz (using zcat(1) to show text content) and noticed this option:



            apt::cmd::show-update-stats


            So I worked out the following command that did exactly what I wanted:



            # apt-get -o apt::cmd::show-update-stats=true update


            Tested to be working on Xenial and Bionic.






            share|improve this answer




























              0














              From man 8 apt:




              ... enables some options ...




              Then I went through /usr/share/doc/apt/examples/configure-index.gz (using zcat(1) to show text content) and noticed this option:



              apt::cmd::show-update-stats


              So I worked out the following command that did exactly what I wanted:



              # apt-get -o apt::cmd::show-update-stats=true update


              Tested to be working on Xenial and Bionic.






              share|improve this answer


























                0












                0








                0







                From man 8 apt:




                ... enables some options ...




                Then I went through /usr/share/doc/apt/examples/configure-index.gz (using zcat(1) to show text content) and noticed this option:



                apt::cmd::show-update-stats


                So I worked out the following command that did exactly what I wanted:



                # apt-get -o apt::cmd::show-update-stats=true update


                Tested to be working on Xenial and Bionic.






                share|improve this answer













                From man 8 apt:




                ... enables some options ...




                Then I went through /usr/share/doc/apt/examples/configure-index.gz (using zcat(1) to show text content) and noticed this option:



                apt::cmd::show-update-stats


                So I worked out the following command that did exactly what I wanted:



                # apt-get -o apt::cmd::show-update-stats=true update


                Tested to be working on Xenial and Bionic.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 2 hours ago









                iBugiBug

                1441212




                1441212






























                    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%2f1128447%2fmake-apt-get-update-show-the-exact-output-as-apt-update%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

                    Liste der Baudenkmäler in Partschins

                    Sámuel Mokry

                    Parko Thabor