Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm writing a small daemon in c/c++ and I need to get the number of updates available and how many of them are security updates.
So far I know I could use either update-notifier or nagios but just for getting the number of updates these have way to many dependencies that i don't need/want on an headless server.
Is there any way to get this information directly through apt or are there even libs for c/c++ with this functionality?
I have byobu running on my server and it somehow retrieves this information and displays it but I don't know how.

share|improve this question
up vote 4 down vote accepted

You want /usr/lib/update-notifier/apt-check from the update-notifier-common package. Run /usr/lib/update-notifier/apt-check -h for usage information. It has both human readable and machine readable forms.

share|improve this answer
This is how your motd does it. So I believe the package is already installed by default. – Robie Basak Feb 11 '13 at 11:14
OK i just checked and if i install update-notifier-common instead of update-notifier i don't get prompted to install the 160~ dependencies so this works thanks. But if anyone knows of a good c/c++ lib an quick hint would still be appreciated. For now I'll go with this solution. – K. Hendrik Feb 11 '13 at 11:20
The update-motd.d skript and apt-check both are not installed on my server but they are present on my pc so maybe it is a server os thing. – K. Hendrik Feb 11 '13 at 12:17

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.