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.
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.
2. Optionally, inspect upgradeable packages with the following command:
apt list --upgradeable
The command shows the list of packages that have newer versions available.
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.
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.
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.