Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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 trying to write a script to upgrade a bunch of remote machines and would like to verify that one package in particular is upgraded.

With yum, I could say yum upgrade specific-package, and it would complain if it fails to upgrade the package. With apt, as far as I know, I can only say apt-get upgrade, and if apt fails to find the new version or fails to resolve the dependencies for the new version, it will silently decide not to install it.

Is there any way to get apt-get to complain if it decides to not upgrade a package (short of scripting a call to dpkg --compare-versions)?

share|improve this question
up vote 8 down vote accepted

You can use apt-get install to do what you want. The apt-get manpage says the following:

This is also the target to use if you want to upgrade one or more already-installed packages without upgrading every package you have on your system. Unlike the "upgrade" target, which installs the newest version of all currently installed packages, "install" will install the newest version of only the package(s) specified. Simply provide the name of the package(s) you wish to upgrade, and if a newer version is available, it (and its dependencies, as described above) will be downloaded and installed.

If you are wanting to install a known version of a package you can specify that on the commandline too.

apt-get install apache2=2.2.14-5ubuntu8.3
share|improve this answer

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.