apt-get update, it downloads the package list and if there are upgradable packages it outputs something like
1 package can be upgraded. Run 'apt list --upgradable' to see it.
I could parse the output grepping for "can be upgraded" or something similar, but there must be a more elegant way to know if there are packages that be upgraded after doing an update.
I noticed that
apt-get update outputs this information nearly immediately after downloading the data, while if i run
apt list --upgradeable it takes a long time, presumably because it does not just tell me how many packages there are, but goes on to produce a full list of them, which I don't need. I just need to quickly know if there are any packages to update.
Note: an answer that requires to use a programming interface to apt to do this would be acceptable