How do you see what packages are available for update in Ubuntu

How do you see what packages are available for update in Ubuntu

On managing a Ubuntu server in production you do not always want to just run update and upgrade etc as this will sometimes break your installed or configured sites, systems.

So to get a good idea what packages will be upgraded and for you then to make a good decision if you need to upgrade do the following.

First off you can run this command to get all the latest package lists.

sudo apt update

This will give the output:

Get:1 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB]
Hit:2 http://za.archive.ubuntu.com/ubuntu xenial InRelease
Hit:3 http://ppa.launchpad.net/certbot/certbot/ubuntu xenial InRelease
Get:4 http://za.archive.ubuntu.com/ubuntu xenial-updates InRelease [102 kB]
Get:5 https://archive.serverdensity.com/ubuntu all InRelease [3,997 B]
Get:6 http://za.archive.ubuntu.com/ubuntu xenial-backports InRelease [102 kB]
Hit:7 http://repo.zabbix.com/zabbix/3.0/ubuntu xenial InRelease
Hit:8 https://deb.nodesource.com/node_7.x xenial InRelease
Ign:9 https://apt.datadoghq.com stable InRelease
Hit:10 https://apt.datadoghq.com stable Release
Fetched 310 kB in 2s (111 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
46 packages can be upgraded. Run 'apt list --upgradable' to see them.

Once you have done this you can you can run the command it gives you in the output of previous command with the --upgradable flag.

apt list --upgradable

This will give the packages that will be upgraded on the system for you to review.

Listing... Done
apport/xenial-updates,xenial-updates 2.20.1-0ubuntu2.6 all [upgradable from: 2.20.1-0ubuntu2.5]
certbot/xenial,xenial 0.14.2-1+certbot+16.041 all [upgradable from: 0.12.0-1+certbot~xenial+5]
cloud-initramfs-copymods/xenial-updates,xenial-updates 0.27ubuntu1.4 all [upgradable from: 0.27ubuntu1.3]
cloud-initramfs-dyn-netconf/xenial-updates,xenial-updates 0.27ubuntu1.4 all [upgradable from: 0.27ubuntu1.3]
grub-legacy-ec2/xenial-updates,xenial-updates 0.7.9-113-g513e99e0-0ubuntu1~16.04.1 all [upgradable from: 0.7.9-90-g61eb03fe-0ubuntu1~16.04.1]
iproute2/xenial-updates 4.3.0-1ubuntu3.16.04.1 amd64 [upgradable from: 4.3.0-1ubuntu3]
isc-dhcp-client/xenial-updates 4.3.3-5ubuntu12.7 amd64 [upgradable from: 4.3.3-5ubuntu12.6]
isc-dhcp-common/xenial-updates 4.3.3-5ubuntu12.7 amd64 [upgradable from: 4.3.3-5ubuntu12.6]
libjs-sphinxdoc/xenial-updates,xenial-updates 1.3.6-2ubuntu1.1 all [upgradable from: 1.3.6-2ubuntu1]
linux-firmware/xenial-updates,xenial-updates 1.157.10 all [upgradable from: 1.157.8]
logrotate/xenial-updates 3.8.7-2ubuntu2.16.04.1 amd64 [upgradable from: 3.8.7-2ubuntu2]
nodejs/unknown 7.10.0-1nodesource1~xenial1 amd64 [upgradable from: 7.9.0-1nodesource1~xenial1]
openssh-client/xenial-updates 1:7.2p2-4ubuntu2.2 amd64 [upgradable from: 1:7.2p2-4ubuntu2.1]
openssh-server/xenial-updates 1:7.2p2-4ubuntu2.2 amd64 [upgradable from: 1:7.2p2-4ubuntu2.1]
openssh-sftp-server/xenial-updates 1:7.2p2-4ubuntu2.2 amd64 [upgradable from: 1:7.2p2-4ubuntu2.1]
overlayroot/xenial-updates,xenial-updates 0.27ubuntu1.4 all [upgradable from: 0.27ubuntu1.3]
php7.0-cli/xenial-updates 7.0.18-0ubuntu0.16.04.1 amd64 [upgradable from: 7.0.15-0ubuntu0.16.04.4]
php7.0-common/xenial-updates 7.0.18-0ubuntu0.16.04.1 amd64 [upgradable from: 7.0.15-0ubuntu0.16.04.4]
php7.0-curl/xenial-updates 7.0.18-0ubuntu0.16.04.1 amd64 [upgradable from: 7.0.15-0ubuntu0.16.04.4]
php7.0-fpm/xenial-updates 7.0.18-0ubuntu0.16.04.1 amd64 [upgradable from: 7.0.15-0ubuntu0.16.04.4]
php7.0-gd/xenial-updates 7.0.18-0ubuntu0.16.04.1 amd64 [upgradable from: 7.0.15-0ubuntu0.16.04.4]
php7.0-json/xenial-updates 7.0.18-0ubuntu0.16.04.1 amd64 [upgradable from: 7.0.15-0ubuntu0.16.04.4]
php7.0-mbstring/xenial-updates 7.0.18-0ubuntu0.16.04.1 amd64 [upgradable from: 7.0.15-0ubuntu0.16.04.4]
php7.0-mcrypt/xenial-updates 7.0.18-0ubuntu0.16.04.1 amd64 [upgradable from: 7.0.15-0ubuntu0.16.04.4]
php7.0-mysql/xenial-updates 7.0.18-0ubuntu0.16.04.1 amd64 [upgradable from: 7.0.15-0ubuntu0.16.04.4]
php7.0-opcache/xenial-updates 7.0.18-0ubuntu0.16.04.1 amd64 [upgradable from: 7.0.15-0ubuntu0.16.04.4]
php7.0-readline/xenial-updates 7.0.18-0ubuntu0.16.04.1 amd64 [upgradable from: 7.0.15-0ubuntu0.16.04.4]
php7.0-sybase/xenial-updates 7.0.18-0ubuntu0.16.04.1 amd64 [upgradable from: 7.0.15-0ubuntu0.16.04.4]
php7.0-xml/xenial-updates 7.0.18-0ubuntu0.16.04.1 amd64 [upgradable from: 7.0.15-0ubuntu0.16.04.4]
php7.0-xmlrpc/xenial-updates 7.0.18-0ubuntu0.16.04.1 amd64 [upgradable from: 7.0.15-0ubuntu0.16.04.4]
php7.0-zip/xenial-updates 7.0.18-0ubuntu0.16.04.1 amd64 [upgradable from: 7.0.15-0ubuntu0.16.04.4]
python-acme/xenial,xenial 0.14.2-0+certbot+16.041 all [upgradable from: 0.12.0-1+certbot~xenial+1]
python-certbot/xenial,xenial 0.14.2-1+certbot+16.041 all [upgradable from: 0.12.0-1+certbot~xenial+5]
python-cffi-backend/xenial 1.10.0-0+certbot~xenial+1 amd64 [upgradable from: 1.9.1-2+certbot~xenial+1]
python-openssl/xenial,xenial 17.0.0-0+certbot~xenial+1 all [upgradable from: 16.1.0-1+certbot~xenial+2]
python-parsedatetime/xenial,xenial 2.1-3+certbot~xenial+1 all [upgradable from: 2.1-2+certbot~xenial+1]
python3-apport/xenial-updates,xenial-updates 2.20.1-0ubuntu2.6 all [upgradable from: 2.20.1-0ubuntu2.5]
python3-problem-report/xenial-updates,xenial-updates 2.20.1-0ubuntu2.6 all [upgradable from: 2.20.1-0ubuntu2.5]
python3-software-properties/xenial-updates,xenial-updates 0.96.20.7 all [upgradable from: 0.96.20.6]
snapd/xenial-updates 2.25 amd64 [upgradable from: 2.24.1]
software-properties-common/xenial-updates,xenial-updates 0.96.20.7 all [upgradable from: 0.96.20.6]
sosreport/xenial-updates 3.4-1~ubuntu16.04.1 amd64 [upgradable from: 3.2+git276-g7da50d6-3ubuntu1]
ubuntu-core-launcher/xenial-updates 2.25 amd64 [upgradable from: 2.24.1]
unattended-upgrades/xenial-updates,xenial-updates 0.90ubuntu0.6 all [upgradable from: 0.90ubuntu0.3]
zlib1g/xenial-updates 1:1.2.8.dfsg-2ubuntu4.1 amd64 [upgradable from: 1:1.2.8.dfsg-2ubuntu4]
zlib1g-dev/xenial-updates 1:1.2.8.dfsg-2ubuntu4.1 amd64 [upgradable from: 1:1.2.8.dfsg-2ubuntu4]</pre>
If you are happy with everything you can then upgrade the packages.
sudo apt-get upgrade