sudo apt-get -s upgrade | grep -c '^Inst'

Category: VPS Management

sudo apt-get -s upgrade | grep -c '^Inst'

Count pending upgrades without applying

apt-get -s (simulate) computes the upgrade and prints one Inst line per package to be installed; grep -c counts them. The result is the number of pending updates — ideal for monitoring scripts and deciding when to schedule a maintenance reboot. Nothing is downloaded or changed.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.