Listing Available Package Updates on Ubuntu

Overview

Keeping your Ubuntu server up-to-date is crucial in any production environment. A system should be continuously monitored for new updates to installed packages.

In this tutorial you will be shown different methods of determining whether updates are available or not.

Listing Upgradable Packages

An upgradable package in Ubuntu is a package with updates available from the source repository. We can determine which packages have patches available by running the apt upgrade command.

sudo apt upgrade

Of course, by using this method we will be expected to install the updates via a prompt at the end of the output.

Reading package lists... Done
 Building dependency tree       
 Reading state information... Done
 Calculating upgrade... Done
 The following NEW packages will be installed:
   amd64-microcode intel-microcode iucode-tool libuv1 linux-headers-4.15.0-48 linux-headers-4.15.0-48-generic linux-image-4.15.0-48-generic linux-modules-4.15.0-48-generic
   linux-modules-extra-4.15.0-48-generic python3-netifaces
 The following packages will be upgraded:
   apport apt apt-utils base-files bsdutils cloud-init cloud-initramfs-copymods cloud-initramfs-dyn-netconf command-not-found command-not-found-data console-setup console-setup-linux cryptsetup
   cryptsetup-bin dpkg e2fsprogs ebtables fdisk friendly-recovery gcc-8-base grub-common grub-pc grub-pc-bin grub2-common initramfs-tools initramfs-tools-bin initramfs-tools-core irqbalance
   keyboard-configuration kmod landscape-common language-selector-common libapt-inst2.0 libapt-pkg5.0 libblkid1 libcom-err2 libcryptsetup12 libdrm-common libdrm2 libext2fs2 libfdisk1 libgcc1 libglib2.0-0
   libglib2.0-data libidn11 libkmod2 libldap-2.4-2 libldap-common liblxc-common liblxc1 libmount1 libncurses5 libncursesw5 libnss-systemd libnuma1 libpam-modules libpam-modules-bin libpam-runtime
   libpam-systemd libpam0g libparted2 libpci3 libplymouth4 libpython3-stdlib libpython3.6 libpython3.6-minimal libpython3.6-stdlib libseccomp2 libsmartcols1 libss2 libstdc++6 libsystemd0 libtinfo5 libudev1
   libunistring2 libuuid1 libx11-6 libx11-data libxcb1 linux-firmware linux-generic linux-headers-generic linux-image-generic linux-signed-generic login lshw lxcfs lxd lxd-client man-db mdadm mount
   ncurses-base ncurses-bin ncurses-term netcat-openbsd netplan.io networkd-dispatcher nplan open-iscsi open-vm-tools overlayroot parted passwd pciutils plymouth plymouth-theme-ubuntu-text pollinate psmisc
   python-apt-common python3 python3-apport python3-apt python3-commandnotfound python3-distro-info python3-distupgrade python3-gdbm python3-gi python3-httplib2 python3-minimal python3-problem-report
   python3-update-manager python3.6 python3.6-minimal screen snapd sosreport squashfs-tools ssh-import-id systemd systemd-sysv tar thermald tmux ubuntu-keyring ubuntu-minimal ubuntu-release-upgrader-core
   ubuntu-server ubuntu-standard udev ufw uidmap unattended-upgrades update-manager-core update-notifier-common ureadahead util-linux uuid-runtime wireless-regdb
 149 upgraded, 10 newly installed, 0 to remove and 0 not upgraded.
 Need to get 194 MB of archives.
 After this operation, 386 MB of additional disk space will be used.
 Do you want to continue? [Y/n] 
 

While information, sometimes all the is needed is a nicely formatted list of packages with updates available. Apt provides a command that allows us to do generate a simple listing of package updates.

Apt provides a command called list that generates a list of packages. The list can be filted using flags, such as –installed and –upgradable, for example. We will use the –upgradable flag to generate a list of only packages with updates from their source repositories.

sudo apt list --upgradable

The output will provide valuable information about the package updates available to be installed. The information will include the version number of the update, the target architecture, and the version we are upgrading from.

The following is an example of the output from the command.

Listing... Done
 apport/bionic-updates 2.20.9-0ubuntu7.6 all [upgradable from: 2.20.9-0ubuntu7]
 apt/bionic-updates 1.6.10 amd64 [upgradable from: 1.6.1]
 apt-utils/bionic-updates 1.6.10 amd64 [upgradable from: 1.6.1]
 base-files/bionic-updates 10.1ubuntu2.4 amd64 [upgradable from: 10.1ubuntu2]
 bsdutils/bionic-updates 1:2.31.1-0.4ubuntu3.3 amd64 [upgradable from: 1:2.31.1-0.4ubuntu3]
 cloud-init/bionic-updates 18.5-45-g3554ffe8-0ubuntu1~18.04.1 all [upgradable from: 18.2-14-g6d48d265-0ubuntu1]
 cloud-initramfs-copymods/bionic-updates 0.40ubuntu1.1 all [upgradable from: 0.40ubuntu1]
 cloud-initramfs-dyn-netconf/bionic-updates 0.40ubuntu1.1 all [upgradable from: 0.40ubuntu1]
 command-not-found/bionic-updates 18.04.5 all [upgradable from: 18.04.4]
 command-not-found-data/bionic-updates 18.04.5 amd64 [upgradable from: 18.04.4]
 console-setup/bionic-updates 1.178ubuntu2.9 all [upgradable from: 1.178ubuntu2]
 console-setup-linux/bionic-updates 1.178ubuntu2.9 all [upgradable from: 1.178ubuntu2]
 cryptsetup/bionic-updates 2:2.0.2-1ubuntu1.1 amd64 [upgradable from: 2:2.0.2-1ubuntu1]
 cryptsetup-bin/bionic-updates 2:2.0.2-1ubuntu1.1 amd64 [upgradable from: 2:2.0.2-1ubuntu1]
 dpkg/bionic-updates 1.19.0.5ubuntu2.1 amd64 [upgradable from: 1.19.0.5ubuntu2]
 e2fsprogs/bionic-updates 1.44.1-1ubuntu1.1 amd64 [upgradable from: 1.44.1-1]
 ebtables/bionic-updates 2.0.10.4-3.5ubuntu2.18.04.3 amd64 [upgradable from: 2.0.10.4-3.5ubuntu2]
 fdisk/bionic-updates 2.31.1-0.4ubuntu3.3 amd64 [upgradable from: 2.31.1-0.4ubuntu3]
 friendly-recovery/bionic-updates 0.2.38ubuntu1 all [upgradable from: 0.2.38]
 gcc-8-base/bionic-updates 8.3.0-6ubuntu1~18.04 amd64 [upgradable from: 8-20180414-1ubuntu2]
 grub-common/bionic-updates 2.02-2ubuntu8.13 amd64 [upgradable from: 2.02-2ubuntu8]
 grub-pc/bionic-updates 2.02-2ubuntu8.13 amd64 [upgradable from: 2.02-2ubuntu8]
 grub-pc-bin/bionic-updates 2.02-2ubuntu8.13 amd64 [upgradable from: 2.02-2ubuntu8]
 grub2-common/bionic-updates 2.02-2ubuntu8.13 amd64 [upgradable from: 2.02-2ubuntu8]
 initramfs-tools/bionic-updates 0.130ubuntu3.7 all [upgradable from: 0.130ubuntu3]
 initramfs-tools-bin/bionic-updates 0.130ubuntu3.7 amd64 [upgradable from: 0.130ubuntu3]
 initramfs-tools-core/bionic-updates 0.130ubuntu3.7 all [upgradable from: 0.130ubuntu3]
 irqbalance/bionic-updates 1.3.0-0.1ubuntu0.18.04.1 amd64 [upgradable from: 1.3.0-0.1]
 keyboard-configuration/bionic-updates 1.178ubuntu2.9 all [upgradable from: 1.178ubuntu2]
 kmod/bionic-updates 24-1ubuntu3.2 amd64 [upgradable from: 24-1ubuntu3]
 landscape-common/bionic-updates 18.01-0ubuntu3.3 amd64 [upgradable from: 18.01-0ubuntu3]
 language-selector-common/bionic-updates 0.188.2 all [upgradable from: 0.188]
 libapt-inst2.0/bionic-updates 1.6.10 amd64 [upgradable from: 1.6.1]
 libapt-pkg5.0/bionic-updates 1.6.10 amd64 [upgradable from: 1.6.1]
 libblkid1/bionic-updates 2.31.1-0.4ubuntu3.3 amd64 [upgradable from: 2.31.1-0.4ubuntu3]
 libcom-err2/bionic-updates 1.44.1-1ubuntu1.1 amd64 [upgradable from: 1.44.1-1]
 libcryptsetup12/bionic-updates 2:2.0.2-1ubuntu1.1 amd64 [upgradable from: 2:2.0.2-1ubuntu1]
 libdrm-common/bionic-updates 2.4.95-1~18.04.1 all [upgradable from: 2.4.91-2]
 libdrm2/bionic-updates 2.4.95-1~18.04.1 amd64 [upgradable from: 2.4.91-2]
 libext2fs2/bionic-updates 1.44.1-1ubuntu1.1 amd64 [upgradable from: 1.44.1-1]
 libfdisk1/bionic-updates 2.31.1-0.4ubuntu3.3 amd64 [upgradable from: 2.31.1-0.4ubuntu3]
 libgcc1/bionic-updates 1:8.3.0-6ubuntu1~18.04 amd64 [upgradable from: 1:8-20180414-1ubuntu2]
 libglib2.0-0/bionic-updates 2.56.4-0ubuntu0.18.04.2 amd64 [upgradable from: 2.56.1-2ubuntu1]
 libglib2.0-data/bionic-updates 2.56.4-0ubuntu0.18.04.2 all [upgradable from: 2.56.1-2ubuntu1]