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 this on terminal:
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.
- Balaji Gunasekaran ‘EI’; “Apt upgrade vs apt update“
[…] How to update and upgrade Ubuntu from terminal […]