How to Update Ubuntu from Terminal

September 26, 2024

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
Marko Aleksic
Marko Aleksić is a Technical Writer at phoenixNAP. His innate curiosity regarding all things IT, combined with over a decade long background in writing, teaching and working in IT-related fields, led him to technical writing, where he has an opportunity to employ his skills and make technology less daunting to everyone.
Next you should read
How to Reinstall Ubuntu
July 6, 2022

Reinstalling an operating system and starting fresh is helpful if an upgrade fails or there is an issue with drivers. Other situations that might require an OS reinstall...
Read more
Linux Commands All Users Should Know
October 4, 2022

Linux is famous for its powerful commands. To use Linux effectively, all users should know how to use terminal...
Read more
How To Install Docker on Ubuntu
April 6, 2023

In this tutorial, you will learn to install and use Docker on Ubuntu 20.04 or Ubuntu 22.04.
Read more
Uninstall or Remove Packages in Ubuntu
May 23, 2024

This guide teaches you how to uninstall or remove packages in Ubuntu using the command line or GUI.
Read more