Keeping your Ubuntu Linux machine up to date by upgrading your system packages with apt

Keeping your Ubuntu Linux machine up to date by upgrading your system packages with apt

Hi everyone,

Today, I want to show you how easy it is to upgrade your Ubuntu Linux machine packages using the apt terminal utility.

Updating and upgrading your system package makes your machine more stable and secure. Linux updates are released in the form of packages. Even the Linux Kernel is in this form and the distribution version can be kept up to date when they are released with this tool. Therefore, it is important to know how to keep them up to date.

apt is a package manager utility that can be used to download, install, upgrade, and remove packages from our system. There are 2 commands that we will be using to upgrade our system packages: update and upgrade.

  • update updates the package lists. This allows apt to know which packages are available for installation an upgrading.
  • upgrade performs the package upgrades by downloading and installing the new package versions.

To begin the package upgrade, we must first open a terminal and type sudo apt update:

1 - sudo apt update

This will then fetch the package lists from their respective sources and will let us know how many packages can be upgraded:

2 - sudo apt update complete

100 packages! It’s not surprising to see a number like this when running a development Ubuntu release, so we’ll go ahead and upgrade them all with sudo apt upgrade:

3 - sudo apt upgrade

We will confirm the upgrade by pressing Y, followed by the Enter key:

4 - upgrading packages

It may take a while to upgrade your system packages depending on your internet connection speed and other factors like if your machine uses a hard disk drive. Do note that I do use hard disk drives in some of my machines and I notice that the process is quite fast, but every system is different, so be patient.

5 - package upgrades complete

And this is it. Your machine’s packages are now upgraded.

Now that you know how to keep your machine up to date, I suggest you develop a habit of keeping your system up to date. I do this process daily if my machines are powered on, and if not, it’s usually the first thing I do after power on a machine.