How to Update Ubuntu from Terminal

By
Marko Aleksic
Published:
September 26, 2024
Topics:

Introduction

Keeping an operating system up to date ensures it always has the latest features and security patches. In Ubuntu, Software Updater is an application that checks for updates and provides a graphical interface to install them. However, using a terminal application to update via CLI is also possible.

This article will show you how to update Ubuntu from the terminal.

How to update Ubuntu from Terminal.

Prerequisites

  • Ubuntu installed.
  • Access to a terminal application.
  • A user account with sudo privileges.

How to Update Using Terminal in Ubuntu

As a Debian-based Linux distribution, Ubuntu uses the APT package manager to install, update, and remove software packages via CLI. Below are the two methods to update Ubuntu with APT.

Method 1: apt upgrade

Execute the following steps to check for and install updates in Ubuntu:

1. Refresh the list of packages available in remote repositories:

sudo apt update

If APT detects out-of-date packages on the local system, the output shows their number.

APT package manager output showing that 30 packages on the system can be upgraded.

2. Optionally, inspect upgradeable packages with the following command:

apt list --upgradeable

The command shows the list of packages that have newer versions available.

A list of upgradeable packages in Ubuntu.

3. Start the package upgrade process by typing:

sudo apt upgrade

When prompted, type Y and press Enter to update the current Ubuntu release with new packages.

Upgrading packages on Ubuntu with sudo apt upgrade.

Wait for the process to complete. Once APT finishes the update, the Bash shell prompt returns.

Note: Type sudo apt update && sudo apt upgrade -y to perform the abovementioned actions in a single command.

Method 2: apt dist-upgrade

Before upgrading Ubuntu to a new release, ensure the system is up to date. While executing apt upgrade is usually enough, the recommended procedure is to use the apt dist-upgrade command.

Proceed with the steps below to update Ubuntu using apt dist-upgrade:

1. Refresh the repository package list:

sudo apt update

2. Execute the dist-upgrade command:

sudo apt dist-upgrade

Type Y and press Enter to start the upgrade.

Upgrading packages on Ubuntu with sudo apt dist-upgrade.

The command installs new packages, resolves dependencies, and performs package clean-up, preparing the system for the release upgrade.

3. Once the dist-upgrade is complete, initiate the release upgrade procedure by typing the following command:

sudo do-release-upgrade

Follow the prompts to upgrade Ubuntu to a new version.

Conclusion

This tutorial taught you how to update software packages on your Ubuntu system. It presented two update methods, one for performing everyday system updates and the other to prepare the system for a release upgrade.

If you are new to Ubuntu, read How to Install Wine on Ubuntu and start running Windows applications on Linux.

Was this article helpful?
YesNo