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

apt

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).

Best 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.
...
Related Question