Ubuntu uses the apt and apt-get command in order to manage packages. The apt is the next-generation update of the apt-get command and provides the same features with some extra useful features. The apt command can be used to list upgradeable packages before and upgrade.
Update Package and Repository Information with “apt update”
The apt command uses the package repositories in order to get packages and related information. In order to get the latest and up-to-date information about packages, you should update the package information. First, the apt update command will be executed which will contact the repositories and get the latest information about the installed packages.
$ sudo apt update
List Upgradeable Packages with “apt list –upgradeable”
After the latest information is gathered from the repositories this information will be compared with the currently installed packages information. Then the
apt list --upgradeable command can be used to list upgradeable packages.
$ sudo apt list
The upgradeable packages are listed with the following information. The the first upradeable package line from the output which is like below.
alsa-utils/focal-updates 1.2.2-1ubuntu2 amd64 [upgradable from: 1.2.2-1ubuntu1]
- alsa-utils is the package name that has an updated version in the repository.
- focal-updates is the Ubuntu version for the updates which is focal.
- 1.2.2-1ubuntu2 is the upgradeable or latest version of the package.
- amd64 is the operating system architecture.
- 1.2.2-1ubuntu1 is the currently installed old package version.
Upgrade Packages with “apt dist-upgrade”
After getting list of updates and investigating them with the apt list –upgradeable command wecan upgrade these package with the
apt dist-upgrade command like below. Alternatively the
apt-get dist-upgrade will work too.
$ sudo apt dist-upgrade -y