FreeBSD user joining your ranks. I've been asked to look after an Ubuntu Server running 10.04 LTS.

I see from /usr/lib/update-notifier/update-motd-updates-available that there are a number of updates on the server however I do not see a way to tell which will be updated.

Would anyone be able to point me in the right direction so as I can see which packages will get updated when I run apt-get upgrade?


Can't answer my own question at the moment so throwing this in here for the time being:

Along with the apt-get upgrade --dry-run suggested below, /usr/lib/update-notifier/apt-check -p will list all packages that have updates available.

  • Welcome to the ranks, use and abuse the site if you need further help ;) If you find an answer that satisfies your question please mark it with the green check box next to it. Jan 30, 2012 at 10:45
  • 2
    You should now be able to answer your own question since that you have enough rep to remove new user restrictions.
    – jokerdino
    Jan 30, 2012 at 10:51
  • looks like it's 100rep required or an 8hour wait to answer your own question.
    – Jan Geep
    Jan 30, 2012 at 14:29
  • In 2016, the answer given by @doru is spot on. askubuntu.com/a/788049/560610 Jun 23, 2016 at 22:05

4 Answers 4


As of now (Ubuntu 16.04) you can use apt list with the --upgradable flag;

sudo apt update
apt list --upgradable

and you will get a list with all upgradable packages.

  • 1
    Excellent! That's exactly what I wanted to see :) Jun 23, 2016 at 22:03
  • apt is unknown command in 12.04
    – confiq
    Jul 11, 2016 at 8:50
  • 1
    @confiq "APT 1.0 was released on the 1. April 2014", so is possible to not being upgraded on your system. Try to see which version of apt you have installed running sudo apt-cache policy apt.
    – doru
    Jul 12, 2016 at 16:17
  • that explains...
    – confiq
    Jul 14, 2016 at 7:42

You could install aptitude if it isn't already installed. It's a great tool for managing packages in a headless setup.

enter image description here

Otherwise if you just want to see what's going to happen when you run something, use the --dry-run argument and it won't actually do anything, it'll just tell you what it would do:

From the apt-get man page

-s, --simulate, --just-print, --dry-run, --recon, --no-act
          No action; perform a simulation of events that would occur but do
          not actually change the system. Configuration Item:

          Simulate prints out a series of lines each one representing a dpkg
          operation, Configure (Conf), Remove (Remv), Unpack (Inst). Square
          brackets indicate broken packages with and empty set of square
          brackets meaning breaks that are of no consequence (rare).

Add the option to the command this way

apt upgrade --dry-run
  • 5
    I disfigured your answer, hope you don't mind. Jan 30, 2012 at 10:44
  • 2
    Interestingly apt-get upgrade --dry-run doesn't require sudo, which makes it perfect for an automated display of required package updates.
    – dshepherd
    Mar 4, 2015 at 15:33
  • even more interesting is, that on my Ubuntu 14.04 LTS "apt-get -s update" doesn't accept "-s"... nor "--dry-run", "--no-act"... why would that be?
    – mBardos
    Jun 8, 2017 at 12:04
  • @mBardos Have you replaced the apt-get in your path with a "helper" script? Check which apt-get to make sure it's /usr/bin/apt-get
    – Oli
    Jun 9, 2017 at 8:14
  • martonb@martonb-ubu:~/work/qt$ which apt-get /usr/bin/apt-get Does this work for you on Ubuntu 14.04 LTS? martonb@martonb-ubu:~/work/qt$ apt-get -s update E: Command line option 's' [from -s] is not known.
    – mBardos
    Jun 9, 2017 at 10:57

Below command will show you the list of installed packages which has an update available in the repositories.

dpkg --get-selections | xargs apt-cache policy {} | grep -1 Installed | sed -r 's/(:|Installed: |Candidate: )//' | uniq -u | tac | sed '/--/I,+1 d' | tac | sed '$d' | sed -n 1~2p
  • 1
    That's a nice bit of command line magic! Dec 18, 2015 at 9:55
  • 1
    Nice, but @sierrasdetandil’s and @doru’ answers do exactly the same in a beautifully concise way...
    – Giuseppe
    Oct 5, 2016 at 8:13
  • Yes, but aptitude is an additional install and apt doesn't like to be scripted.
    – Mausy5043
    Feb 13, 2022 at 8:32
  • @Avinash Raj Did you mean to include --ignore-case or -i instead of 1 at the command pipe segment grep -1 Installed ? Did you mean -A 1 by any chance, because they have the same output! I wonder about this behavior and whether there was a placeholding variable flag for grep that can be substituted directly with a number!
    – polendina
    Aug 25, 2022 at 18:20

Another alternative would be to use aptitude with a search term:

aptitude search '~U'

(Note the uppercase 'U')

That means: "search for all packages that are installed and can be upgraded". Reference: aptitude user's manual

By default, aptitude search shows for each package its name, description and a few flags, but you could also adapt the output to your needs. For example, to list only the package names, the command would be:

aptitude search -F '%p' --disable-columns '~U'

(--disable-columns avoids padding whitespace at the end of the lines)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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