How to update and upgrade Ubuntu from terminal

This post explains how to update and install packages in Ubuntu from a terminal. It also explains how to perform a version upgrade.

apt-get and apt is the same command. We use apt in this post because is shorter.

To update the package source list or repositories, type this command:

sudo apt update

Take into account that the “update” command does not update the applications themselves, it just updates the package source list. This is why is convenient to run this command before installing an app or updating the existing apps in your system.

If you need to install a package, type:

sudo apt install packagename

“packagename” is just an example but it could be the name of the corresponding package (for example, default-jre).

To update the applications already installed in your system, type:

sudo apt upgrade

To remove packages that are no longer needed because they are no longer used by apps (it may happen after application updates, when dependencies changes), type:

sudo apt autoremove

When Ubuntu releases a new version, you can upgrade it from command line by typing on terminal:

sudo do-release-upgrade

do-release-upgrade is a Python script located on /usr/share/pyshared/DistUpgrade

The equivalent command in Debian would be apt dist-upgrade.

If you want to upgrade to the latest release:

do-release-upgrade -d

You need to have the latest versions on all packages before being able to upgrade the system. So you may need to repeat many times the previous commands before being able to perform the upgrade.

If you want to update or upgrade it using a GUI, open the Software Updater from the OS or go to the terminal and type:


If you want to update or upgrade to the latest development release, type:

update-manager -d

External references

One comment

Leave a Reply

Your email address will not be published. Required fields are marked *