How to check available Package Updates in Linux

Regular system maintenance is necessary, which ensures that the system is secure, and this is common for all the operating systems not just Linux.

There is no specific scheduled window for Linux to release the package updates. Hence you need to perform the package update at least once a month to get the latest updates.

If monthly update isn’t possible, it should be performed at least once in a quarter.

Patching can be performed using one of the below methods, but most of the companies are installing only security patches, which is necessary to make the system more stable and secure.

  • Installing full patch, which includes security, bug fixes & enhancements
  • Installing only security patches
  • Installing security & bug fixes

In this guide, we will explain how to list available package updates in various Linux distributions, like RHEL, CentOS, Fedora, Arch Linux, Debian, Ubuntu and openSUSE.

Package management tools are playing a key role here, so you should have hands on experience in it:

1) Listing package updates in CentOS/RHEL 6/7

‘yum’ package manager is the default manager for RHEL/CentOS 6/7 systems, you can use it to verify this information.

‘yum’ can be used in the following 3 ways to check and update the packages:

  • ‘yum check-update’ command returns a list of the packages to be updated in list format.
  • ‘yum list updates’ command is similar to yum check-update and returns a list of packages to be updated in list format.
  • ‘yum update’ command will update currently installed packages to latest version if a package update is available.

1(a): Using ‘yum check-update’ command

Run the ‘yum check-update’ command without any parameters to obtain the available package updates as shown below:

# yum check-update
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
epel/metalink                                                                       |  19 kB     00:00
epel: ewr.edge.kernel.org              
base                                                                                | 3.7 kB     00:00
centos-sclo-sclo                                                                    | 2.9 kB     00:00
epel                                                                                | 3.2 kB     00:00
epel/primary                                                                        | 3.2 MB     00:00
epel                                                                                2518/12518
extras                                                                              | 3.4 kB     00:00
updates                                                                             | 3.4 kB     00:00
updates/primary_db                                                                  | 1.2 MB     00:00 … 

abrt.x86_64                                             2.0.8-44.el6.centos                         base
abrt-addon-ccpp.x86_64                                  2.0.8-44.el6.centos                         base
abrt-addon-kerneloops.x86_64                            2.0.8-44.el6.centos                         base
abrt-addon-python.x86_64                                2.0.8-44.el6.centos                         base
dbus-libs.x86_64                                        1:1.2.24-9.el6                              base
device-mapper-persistent-data.x86_64                    0.6.2-0.2.rc7.el6                           base
dhclient.x86_64                                         12:4.1.1-61.P1.el6.centos                   updates
dhcp-common.x86_64                                      12:4.1.1-61.P1.el6.centos                   updates

If you would like to count the number of packages to be upgraded, use the following format:

# yum check-update | wc -l
103

1(b): Using ‘yum list updates’ command

‘yum list updates’ command is like ‘yum check-update’, which displays the available package updates as shown below:

# yum list updates

Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
 * epel: ewr.edge.kernel.org
Updated Packages
 
abrt.x86_64                                        2.0.8-44.el6.centos                     base
abrt-addon-ccpp.x86_64                             2.0.8-44.el6.centos                     base
abrt-addon-kerneloops.x86_64                       2.0.8-44.el6.centos                     base
abrt-addon-python.x86_64                           2.0.8-44.el6.centos                     base
abrt-cli.x86_64                                    2.0.8-44.el6.centos                     base
abrt-libs.x86_64                                   2.0.8-44.el6.centos                     base
abrt-python.x86_64                                 2.0.8-44.el6.centos                     base
abrt-tui.x86_64                                    2.0.8-44.el6.centos                     base
bind-libs.x86_64                                   32:9.8.2-0.68.rc1.el6                   base
bind-utils.x86_64                                  32:9.8.2-0.68.rc1.el6                   base
dhclient.x86_64                                    12:4.1.1-61.P1.el6.centos               updates
dhcp-common.x86_64                                 12:4.1.1-61.P1.el6.centos               updates

Available package updates can be counted as shown below:

# yum list updates | wc -l
103

1(c): Using ‘yum update’ command

We generally use ‘yum update’ command to update the system packages to their latest versions available, but this command can also be used to gather additional information such as a list of packages to be updated, to be installed, package download size, and the repository information.

Using ‘yum update’ command, will get you more information than the other two commands.

# yum update

Loaded plugins: fastestmirror, security
Setting up Update Process
Loading mirror speeds from cached hostfile
epel: ewr.edge.kernel.org
Resolving Dependencies
--> Running transaction check
---> Package abrt.x86_64 0:2.0.8-43.el6.centos will be updated
---> Package abrt.x86_64 0:2.0.8-44.el6.centos will be an update
---> Package abrt-addon-ccpp.x86_64 0:2.0.8-43.el6.centos will be updated
.
.
---> Package yum-utils.noarch 0:1.1.30-42.el6_10 will be an update
--> Finished Dependency Resolution
 
Dependencies Resolved

===============================================================================================
 Package                        Arch        Version                       Repository      Size
===============================================================================================
Installing:
 kernel                         x86_64      2.6.32-754.3.5.el6            updates         32 M
Updating:
 abrt                           x86_64      2.0.8-44.el6.centos           base           229 k
 abrt-addon-ccpp                x86_64      2.0.8-44.el6.centos           base           124 k
 abrt-addon-kerneloops          x86_64      2.0.8-44.el6.centos           base            71 k
 bind-libs                      x86_64      32:9.8.2-0.68.rc1.el6         base           892 k
 bind-utils                     x86_64      32:9.8.2-0.68.rc1.el6         base           189 k
 binutils                       x86_64      2.20.51.0.2-5.48.el6          base           2.8 M
 .
 .
 sos                            noarch      3.2-63.el6.centos.2           updates        326 k
 systemtap-runtime              x86_64      2.9-9.el6                     base           206 k
 yum-utils                      noarch      1.1.30-42.el6_10              updates        114 k

Transaction Summary
===============================================================================================
Install       1 Package(s)
Upgrade      98 Package(s)

Total download size: 190 M
Is this ok [y/N]: n
Exiting on user Command
Your transaction was saved, rerun it with:
 yum load-transaction /tmp/yum_save_tx-2020-08-18-10-41obLDvp.yumtx

Use the below command to check whether an update is available for a particular package. If yes, you will get information about the package. If not, it will show “Error: No matching Packages to list”.

# yum list updates sos

Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
epel: ewr.edge.kernel.org
Updated Packages
sos.noarch                                  3.2-63.el6.centos.2              updates 

2) Checking available package updates in CentOS/RHEL 8 & Fedora

CentOS 8, RHEL 8 and Fedora systems use DNF package manager. Hence, we can use the dnf command to get this information.

Here are the four ways we could use the dnf command:

  • dnf check-update‘: This command returns a list of packages to be updated in list format.
  • dnf list updates‘: This command is similar to ‘dnf check-update’ and returns a list of the packages to be updated in list format.
  • dnf update‘: This command will update currently installed packages to their latest version’s if update’s are available.
  • dnf updateinfo‘ : It will list all the advisories available in the system.

2(a): Using ‘dnf check-update’ command

‘dnf check-update’ command checks whether any updates are available for your system. If there are, it will return a list of packages to be updated along with a DNF exit code listed below:

  • 100 – If any updates are available
  • 0 – No updates available
  • 1 – If any error occurs
# dnf check-update

Last metadata expiration check: 0:01:06 ago on Sun 19 Aug 2020 04:14:00 PM IST.

GeoIP-GeoLite-data.noarch               2018.04-1.fc26           updates                 
GraphicsMagick.x86_64                   1.3.29-1.fc26            updates                 
ImageMagick.x86_64                      6.9.9.38-1.fc26          updates                 
ImageMagick-libs.x86_64                 6.9.9.38-1.fc26          updates                 
ImageMagick-perl.x86_64                 6.9.9.38-1.fc26          updates                 
LibRaw.x86_64                           0.18.11-1.fc26           updates                 
appstream-data.noarch                   26-18.fc26               updates                 
autocorr-en.noarch                      1:5.3.7.2-9.fc26         updates                 
boost.x86_64                            1.63.0-12.fc26           updates                 
boost-atomic.x86_64                     1.63.0-12.fc26           updates                 
boost-chrono.x86_64                     1.63.0-12.fc26           updates                 
boost-container.x86_64                  1.63.0-12.fc26           updates               

2(b): Using ‘dnf list updates’ command

The ‘dnf list updates’ command is similar to the ‘dnf check-update’ command, which provides a list of packages that need to be updated in a list format.

# dnf list updates

Last metadata expiration check: 0:01:06 ago on Sun 19 Aug 2020 04:14:00 PM IST.

GeoIP-GeoLite-data.noarch               2018.04-1.fc26           updates                 
GraphicsMagick.x86_64                   1.3.29-1.fc26            updates                 
ImageMagick.x86_64                      6.9.9.38-1.fc26          updates                 
ImageMagick-libs.x86_64                 6.9.9.38-1.fc26          updates                 
ImageMagick-perl.x86_64                 6.9.9.38-1.fc26          updates                 
LibRaw.x86_64                           0.18.11-1.fc26           updates                 
appstream-data.noarch                   26-18.fc26               updates                 
autocorr-en.noarch                      1:5.3.7.2-9.fc26         updates                 
boost.x86_64                            1.63.0-12.fc26           updates                 
boost-atomic.x86_64                     1.63.0-12.fc26           updates                 
boost-chrono.x86_64                     1.63.0-12.fc26           updates                 
boost-container.x86_64                  1.63.0-12.fc26           updates                           

2(c): Using ‘dnf update’ command

If there are package updates available, then the ‘dnf update’ command will update the currently installed packages to their latest version.

In addition, it shows a list of packages that need to be installed, upgradable or removed as part of this operation. Also, it provides the total size to be downloaded.

# dnf update

Last metadata expiration check: 0:05:22 ago on Sun 19 Aug 2020 04:14:00 PM IST.
Dependencies resolved.

====================================================================================
 Package                  Arch          Version                Repository      Size
====================================================================================
Installing:
 kernel                   x86_64        4.16.11-100.fc26       updates         74 k
 kernel-core              x86_64        4.16.11-100.fc26       updates         23 M
 kernel-debug-devel       x86_64        4.16.11-100.fc26       updates         12 M
 kernel-modules           x86_64        4.16.11-100.fc26       updates         27 M
 kernel-modules-extra     x86_64        4.16.11-100.fc26       updates        2.2 M
Upgrading:
 GeoIP-GeoLite-data       noarch        2018.04-1.fc26         updates        551 k
 GraphicsMagick           x86_64        1.3.29-1.fc26          updates        1.5 M
 ImageMagick              x86_64        6.9.9.38-1.fc26        updates        183 k
 xen-libs                 x86_64        4.8.3-5.fc26           updates        657 k
 xen-licenses             x86_64        4.8.3-5.fc26           updates        118 k
Removing:
 kernel                   x86_64        4.12.14-300.fc26       @updates         0 
 kernel-core              x86_64        4.12.14-300.fc26       @updates        54 M
 kernel-debug-devel       x86_64        4.12.14-300.fc26       @updates        43 M
 kernel-modules           x86_64        4.12.14-300.fc26       @updates        23 M
 kernel-modules-extra     x86_64        4.12.14-300.fc26       @updates       2.0 M

Transaction Summary
====================================================================================
Install    5 Packages
Upgrade  280 Packages
Remove     5 Packages
Total download size: 687 M
Is this ok [y/N]: n
Operation aborted.

2(d): Using ‘dnf updateinfo’ command

‘dnf updateinfo’ command displays just counts of advisory types. If you want to know more about it, use the appropriate arguments with the command.

# dnf updateinfo

Last metadata expiration check: 0:00:00 ago on Sun 19 Aug 2020 04:14:00 PM IST.
Updates Information Summary: available
    28 Security notice(s)
         2 Critical Security notice(s)
         2 Important Security notice(s)
         8 Moderate Security notice(s)
         5 Low Security notice(s)
    47 Bugfix notice(s)
    21 Enhancement notice(s)

3) How to check available package updates in Arch Linux

‘pacman’ stands for package manager utility, which is a command-line utility to install, build, remove and manage Arch Linux packages.

‘pacman -Qu’ command will query and filter the packages that are out-of-date on the local system as shown below:

# pacman -Qu
json-glib 1.2.8-1 -> 1.4.2-2
jsoncpp 1.8.1-1 -> 1.8.4-2
keyutils 1.5.10-1 -> 1.5.10-2
kidletime 5.37.0-1 -> 5.49.0-1
kmod 24-1 -> 25-1
krb5 1.15.1-1 -> 1.16.1-1
kwayland 5.37.0-1 -> 5.49.0-1
kwindowsystem 5.37.0-1 -> 5.49.0-1
lame 3.99.5-3 -> 3.100-2
lcms2 2.8-2 -> 2.9-1
less 487-1 -> 530-1
libaio 0.3.110-1 -> 0.3.111-1
libarchive 3.3.2-1 -> 3.3.2-2
libass 0.13.7-1 -> 0.14.0-1
libassuan 2.4.3-1 -> 2.5.1-1
libatasmart 0.19-3 -> 0.19-4
libatomic_ops 7.4.6-1 -> 7.6.6-1
libblockdev 2.10-1 -> 2.19-1
libbluray 1.0.1-1 -> 1.0.2-1

Run the following command to count the number of packages that can be upgraded:

# pacman -Qu | wc -l
475

Alternatively, this can be done using the below command:

# pacman -Syu

:: Synchronizing package databases...
 testing is up to date
 core is up to date
 extra is up to date
 community is up to date
 multilib is up to date
 archlinuxfr is up to date
:: Starting full system upgrade...

Packages (548) acl-2.2.53-1  adwaita-icon-theme-3.28.0-1  alsa-lib-1.1.6-1
               aom-1.0.0-1  archlinux-keyring-20180808-1  argon2-20171227-3
               at-spi2-atk-2.26.2-1  at-spi2-core-2.28.0-1  atk-2.28.1-1
               attr-2.4.48-1  avahi-0.7+16+g1cc2b8e-2  bash-4.4.023-1
               binutils-2.31.1-3  bison-3.0.5-1  btrfs-progs-4.17.1-1
               bzip2-1.0.6-7  ca-certificates-mozilla-3.38-1  cairo-1.15.12-1
               cantarell-fonts-1:0.101-1  cmake-3.11.4-2  colord-1.4.3-2
               compositeproto-0.4.2-3 [removal]  coreutils-8.30-1
               cryptsetup-2.0.4-1  curl-7.61.0-2  damageproto-1.2.1-3 [removal]
               db-5.3.28-4  dbus-1.12.10-1  dbus-glib-0.110-1  dconf-0.28.0-1
               desktop-file-utils-0.23+4+g92af410-1  device-mapper-2.02.181-1
               dhcpcd-7.0.7-1  dmraid-1.0.0.rc16.3-11
               dmxproto-2.3.1-3 [removal]  dri2proto-2.8-2 [removal]
               dri3proto-1.0-1 [removal]  e2fsprogs-1.44.3-1  exo-0.12.2-1
               expat-2.2.5-1  fakeroot-1.23-1  ffmpeg-1:4.0.2-2  figlet-2.2.5-3
               file-5.34-1  filesystem-2018.1-2  firefox-61.0.2-1
Total Download Size:    679.43 MiB
Total Installed Size:  2816.48 MiB
Net Upgrade Size:       394.96 MiB

:: Proceed with installation? [Y/n] n

4) How to find the available package updates in openSUSE

openSUSE system uses zypper package manager hence we can use the ‘zypper command‘ to get this information.

4(a): Using ‘zypper list-updates’ command

zypper list-updates command returns a list of packages to be updated in list format:

# zypper list-updates
Loading repository data...
Warning: Repository 'Update Repository (Non-Oss)' appears to be outdated. Consider using a different mirror or server.
Warning: Repository 'Main Update Repository' appears to be outdated. Consider using a different mirror or server.
Reading installed packages...
S | Repository             | Name                             | Current Version                   | Available Version                     | Arch 
--+------------------------+----------------------------------+-----------------------------------+---------------------------------------+-------
v | Main Update Repository | ImageMagick                      | 6.8.8.1-30.6.1                    | 6.8.8.1-30.21.1                       | x86_64
v | Main Update Repository | MozillaFirefox                   | 52.4.0-57.18.2                    | 52.6-57.30.1                          | x86_64
v | Main Update Repository | MozillaThunderbird               | 52.4.0-41.18.1                    | 52.5.2-41.24.1                        | x86_64
v | Main Update Repository | SuSEfirewall2                    | 3.6.312-5.6.1                     | 3.6.312-5.12.1                        | noarch
v | Main Update Repository | apparmor-abstractions            | 2.10.2-12.3.1                     | 2.10.3-12.6.1                         | noarch
v | Main Update Repository | apparmor-docs                    | 2.10.2-12.3.1                     | 2.10.3-12.6.1                         | noarch
v | Main Update Repository | apparmor-parser                  | 2.10.2-12.3.1                     | 2.10.3-12.6.1                         | x86_64
v | Main Update Repository | apparmor-profiles                | 2.10.2-12.3.1                     | 2.10.3-12.6.1                         | noarch
v | Main Update Repository | apparmor-utils                   | 2.10.2-12.3.1                     | 2.10.3-12.6.1                         | noarch
.
.

4(b): Using ‘zypper update’ command

This command will update currently installed packages to their latest versions, if package updates are available:

# zypper update
Loading repository data...
Warning: Repository 'Update Repository (Non-Oss)' appears to be outdated. Consider using a different mirror or server.
Warning: Repository 'Main Update Repository' appears to be outdated. Consider using a different mirror or server.
Reading installed packages...

The following package is going to be REMOVED:
  gimp-help-browser

The following package is going to be upgraded:
  gimp

1 package to upgrade, 1 to remove.
Overall download size: 6.9 MiB. Already cached: 0 B. After the operation, 3.6 MiB will be freed.
Continue? [y/n/...? shows all options] (y): y
Retrieving package gimp-2.8.18-2.6.2.x86_64                                                                                                              (1/1),   6.9 MiB ( 28.1 MiB unpacked)
Retrieving delta: ./x86_64/gimp-2.8.18-2.3.1_2.6.2.x86_64.drpm, 682.7 KiB
Retrieving: gimp-2.8.18-2.3.1_2.6.2.x86_64.drpm ...........................................................................................................................[done (49.2 KiB/s)]
Applying delta: ./gimp-2.8.18-2.3.1_2.6.2.x86_64.drpm ..................................................................................................................................[done]
Checking for file conflicts: ...........................................................................................................................................................[done]
(1/1) Installing: gimp-2.8.18-2.6.2.x86_64 .............................................................................................................................................[done]
There are some running programs that might use files deleted by recent upgrade. You may wish to check and restart some of them. Run 'zypper ps -s' to list these programs.

5) How to list the available package updates in Debian/Ubuntu

‘apt’ and ‘apt-get’ command can be used to find this information on Debian/Ubuntu and it’s derivatives.

Run “apt update” or “apt-get update” before checking the list of available package updates. This will refresh the repository meta-data.

This can be done using the below five commands.

  • ‘apt list –upgradable’: returns a list of packages to be updated in list format.
  • ‘apt-get upgrade –dry-run’: returns a list of packages to be updated in list format.
  • ‘apt-get -s upgrade’: returns a list of packages to be updated in list format.
  • ‘apt upgrade’: will update currently installed packages to their latest versions if updates are available.
  • ‘apt-get upgrade’: will update currently installed packages to their latest versions if updates are available.

5(a): Using ‘apt list –upgradable’ command

The ‘apt list –upgradable’ command displays a list of packages to be updated and other information in list format:

# apt list --upgradable
Listing... Done
apache2/artful-updates 2.4.27-2ubuntu4.2 amd64 [upgradable from: 2.4.27-2ubuntu4.1]
apache2-bin/artful-updates 2.4.27-2ubuntu4.2 amd64 [upgradable from: 2.4.27-2ubuntu4.1]
apache2-data/artful-updates,artful-updates 2.4.27-2ubuntu4.2 all [upgradable from: 2.4.27-2ubuntu4.1]
apache2-utils/artful-updates 2.4.27-2ubuntu4.2 amd64 [upgradable from: 2.4.27-2ubuntu4.1]
apt/artful-updates 1.5.2 amd64 [upgradable from: 1.5.1]
apt-transport-https/artful-updates 1.5.2 amd64 [upgradable from: 1.5.1]
apt-utils/artful-updates 1.5.2 amd64 [upgradable from: 1.5.1]
avahi-autoipd/artful-updates 0.6.32-1ubuntu1.1 amd64 [upgradable from: 0.6.32-1ubuntu1]
avahi-daemon/artful-updates 0.6.32-1ubuntu1.1 amd64 [upgradable from: 0.6.32-1ubuntu1]
avahi-utils/artful-updates 0.6.32-1ubuntu1.1 amd64 [upgradable from: 0.6.32-1ubuntu1]
bsdutils/artful-updates 1:2.30.1-0ubuntu4.2 amd64 [upgradable from: 1:2.30.1-0ubuntu4.1]
desktop-file-utils/artful-updates 0.23-1ubuntu3.17.10.1 amd64 [upgradable from: 0.23-1ubuntu3]

To count the packages that needs to be upgraded, use the below command:

# apt list --upgradable | wc -l
89

5(b): Using ‘apt-get upgrade’ command

The command along with the --dry-run or --simulate or --just-print option’s performs a simulation of events that would occur, but does not actually change the system.

# apt-get upgrade --dry-run
or
# apt-get --simulate upgrade
or
# apt-get --just-print upgrade

Reading package lists... Done
Building dependency tree      
Reading state information... Done
Calculating upgrade... Done
The following packages were automatically installed and are no longer required:
  linux-headers-4.13.0-38 linux-headers-4.13.0-38-generic linux-headers-4.13.0-39 linux-headers-4.13.0-39-generic linux-headers-4.13.0-43 linux-headers-4.13.0-43-generic linux-image-4.13.0-38-generic
  linux-image-4.13.0-39-generic linux-image-4.13.0-43-generic linux-image-extra-4.13.0-38-generic linux-image-extra-4.13.0-39-generic linux-image-extra-4.13.0-43-generic
Use 'sudo apt autoremove' to remove them.
The following packages will be upgraded:
  apache2 apache2-bin apache2-data apache2-utils apt apt-transport-https apt-utils avahi-autoipd avahi-daemon avahi-utils bsdutils desktop-file-utils docker-ce fdisk fonts-opensymbol google-chrome-stable
  hdparm ifupdown libapt-inst2.0 libapt-pkg5.0 libavahi-client3 libavahi-common-data libavahi-common3 libavahi-core7 libavahi-glib1 libavahi-ui-gtk3-0 libblkid1 libfdisk1 libmount1 libnss-myhostname
  libpam-modules libpam-modules-bin libpam-runtime libpam-systemd libpam0g libplymouth4 libpython3-dev libpython3-stdlib libreoffice-avmedia-backend-gstreamer libreoffice-base-core libreoffice-calc
  libreoffice-common libreoffice-core libreoffice-draw libreoffice-gnome libreoffice-gtk3 libreoffice-help-en-us libreoffice-impress libreoffice-math libreoffice-ogltrans libreoffice-pdfimport
  libreoffice-style-breeze libreoffice-style-elementary libreoffice-style-galaxy libreoffice-style-papirus libreoffice-style-tango libreoffice-writer libsmartcols1 libsystemd0 libudev1 libuuid1 lshw mount
  notepadqq notepadqq-common nplan papirus-icon-theme plymouth plymouth-label plymouth-theme-ubuntu-logo plymouth-theme-ubuntu-text python3 python3-dev python3-minimal python3-uno python3-update-manager snapd
  systemd systemd-sysv udev uno-libs3 update-manager update-manager-core update-notifier update-notifier-common ure util-linux uuid-runtime
88 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Inst bsdutils [1:2.30.1-0ubuntu4.1] (1:2.30.1-0ubuntu4.2 Ubuntu:17.10/artful-updates [amd64])
Conf bsdutils (1:2.30.1-0ubuntu4.2 Ubuntu:17.10/artful-updates [amd64])
Inst libuuid1 [2.30.1-0ubuntu4.1] (2.30.1-0ubuntu4.2 Ubuntu:17.10/artful-updates [amd64])
Conf libuuid1 (2.30.1-0ubuntu4.2 Ubuntu:17.10/artful-updates [amd64])
Inst libblkid1 [2.30.1-0ubuntu4.1] (2.30.1-0ubuntu4.2 Ubuntu:17.10/artful-updates [amd64])
Conf libblkid1 (2.30.1-0ubuntu4.2 Ubuntu:17.10/artful-updates [amd64])
Inst libfdisk1 [2.30.1-0ubuntu4.1] (2.30.1-0ubuntu4.2 Ubuntu:17.10/artful-updates [amd64])
Conf libfdisk1 (2.30.1-0ubuntu4.2 Ubuntu:17.10/artful-updates [amd64])
Inst libmount1 [2.30.1-0ubuntu4.1] (2.30.1-0ubuntu4.2 Ubuntu:17.10/artful-updates [amd64])
Conf libmount1 (2.30.1-0ubuntu4.2 Ubuntu:17.10/artful-updates [amd64])
Inst libsmartcols1 [2.30.1-0ubuntu4.1] (2.30.1-0ubuntu4.2 Ubuntu:17.10/artful-updates [amd64])

5(c): Using ‘apt upgrade’ command

apt upgrade command will update currently installed packages to their latest versions if updates are available.

Additionally, it gives you a list of packages to be upgradable and total download size as shown below:

# apt upgrade

Reading package lists... Done
Building dependency tree      
Reading state information... Done
Calculating upgrade... Done
The following packages were automatically installed and are no longer required:
  linux-headers-4.13.0-38 linux-headers-4.13.0-38-generic linux-headers-4.13.0-39 linux-headers-4.13.0-39-generic linux-headers-4.13.0-43 linux-headers-4.13.0-43-generic linux-image-4.13.0-38-generic
  linux-image-4.13.0-39-generic linux-image-4.13.0-43-generic linux-image-extra-4.13.0-38-generic linux-image-extra-4.13.0-39-generic linux-image-extra-4.13.0-43-generic
Use 'sudo apt autoremove' to remove them.
The following packages will be upgraded:
  apache2 apache2-bin apache2-data apache2-utils apt apt-transport-https apt-utils avahi-autoipd avahi-daemon avahi-utils bsdutils desktop-file-utils docker-ce fdisk fonts-opensymbol google-chrome-stable
  hdparm ifupdown libapt-inst2.0 libapt-pkg5.0 libavahi-client3 libavahi-common-data libavahi-common3 libavahi-core7 libavahi-glib1 libavahi-ui-gtk3-0 libblkid1 libfdisk1 libmount1 libnss-myhostname
  libpam-modules libpam-modules-bin libpam-runtime libpam-systemd libpam0g libplymouth4 libpython3-dev libpython3-stdlib libreoffice-avmedia-backend-gstreamer libreoffice-base-core libreoffice-calc
  libreoffice-common libreoffice-core libreoffice-draw libreoffice-gnome libreoffice-gtk3 libreoffice-help-en-us libreoffice-impress libreoffice-math libreoffice-ogltrans libreoffice-pdfimport
  libreoffice-style-breeze libreoffice-style-elementary libreoffice-style-galaxy libreoffice-style-tango libreoffice-writer libsmartcols1 libsystemd0 libudev1 libuuid1 lshw mount notepadqq notepadqq-common
  nplan plymouth plymouth-label plymouth-theme-ubuntu-logo plymouth-theme-ubuntu-text python3 python3-dev python3-minimal python3-uno python3-update-manager snapd systemd systemd-sysv udev uno-libs3
  update-manager update-manager-core update-notifier update-notifier-common ure util-linux uuid-runtime
86 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/201 MB of archives.
After this operation, 26.5 MB of additional disk space will be used.
Do you want to continue? [Y/n] n
Abort.

5(d): Using ‘apt-get upgrade’ command

This is similar to the ‘apt upgrade’ command and provides you the same information:

# apt-get upgrade

Reading package lists... Done
Building dependency tree      
Reading state information... Done
Calculating upgrade... Done
The following packages were automatically installed and are no longer required:
  linux-headers-4.13.0-38 linux-headers-4.13.0-38-generic linux-headers-4.13.0-39 linux-headers-4.13.0-39-generic linux-headers-4.13.0-43 linux-headers-4.13.0-43-generic linux-image-4.13.0-38-generic
  linux-image-4.13.0-39-generic linux-image-4.13.0-43-generic linux-image-extra-4.13.0-38-generic linux-image-extra-4.13.0-39-generic linux-image-extra-4.13.0-43-generic
Use 'sudo apt autoremove' to remove them.
The following packages will be upgraded:
  apache2 apache2-bin apache2-data apache2-utils apt apt-transport-https apt-utils avahi-autoipd avahi-daemon avahi-utils bsdutils desktop-file-utils docker-ce fdisk fonts-opensymbol google-chrome-stable
  hdparm ifupdown libapt-inst2.0 libapt-pkg5.0 libavahi-client3 libavahi-common-data libavahi-common3 libavahi-core7 libavahi-glib1 libavahi-ui-gtk3-0 libblkid1 libfdisk1 libmount1 libnss-myhostname
  libpam-modules libpam-modules-bin libpam-runtime libpam-systemd libpam0g libplymouth4 libpython3-dev libpython3-stdlib libreoffice-avmedia-backend-gstreamer libreoffice-base-core libreoffice-calc
  libreoffice-common libreoffice-core libreoffice-draw libreoffice-gnome libreoffice-gtk3 libreoffice-help-en-us libreoffice-impress libreoffice-math libreoffice-ogltrans libreoffice-pdfimport
  libreoffice-style-breeze libreoffice-style-elementary libreoffice-style-galaxy libreoffice-style-tango libreoffice-writer libsmartcols1 libsystemd0 libudev1 libuuid1 lshw mount notepadqq notepadqq-common
  nplan plymouth plymouth-label plymouth-theme-ubuntu-logo plymouth-theme-ubuntu-text python3 python3-dev python3-minimal python3-uno python3-update-manager snapd systemd systemd-sysv udev uno-libs3
  update-manager update-manager-core update-notifier update-notifier-common ure util-linux uuid-runtime
86 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/201 MB of archives.
After this operation, 26.5 MB of additional disk space will be used.
Do you want to continue? [Y/n] n
Abort.

5(e): Using apt-check

Alternatively, use the following apt-check command to find out the number of packages to be upgraded in the system:

# /usr/lib/update-notifier/apt-check 2>&1 | cut -d ';' -f 1

5(f): Using apticron

Additionaly, ‘apticron’ is a simple script which sends daily emails about pending package updates such as security updates, properly handling packages on hold both by dselect and aptitude.

Wrapping Up

In this tutorial, we have shown you several commands used to check for package updates available on various Linux distributions such as RHEL, CentOS, Fedora, openSUSE, Debian, Ubuntu & Arch Linux.

If you found this article helpful, please do share with your friends and spread the knowledge. Please feel free to comment below if you have any queries/concerns. We will get back to you as soon as we can. Happy learning!

About Prakash Subramanian

Prakash Subramanian is a Linux lover and has 3.5+ years of experience in linux server administration with major Linux distribution such as (RHEL, CentOS, Ubuntu). He is currently working as a Senior L2 Linux Server administrator.

View all posts by Prakash Subramanian

2 Comments on “How to check available Package Updates in Linux”

  1. Some very important points you omitted:

    One difference between “apt-get upgrade” and “apt upgrade” is that the latter deletes the deb files after installing them. If you don’t like this, use apt-get.

    If you want to upgrade packages that involve installation or removal of other packages, use dist-upgrade.

    The easy way is to use synaptic, a graphical frontend for apt-get. It works well most of the time (but not always).

Leave a Reply

Your email address will not be published. Required fields are marked *