It is recommended for all Linux system users to keep packages up to date. All the Linux distributions provide security and packages upgrades from time to time. You must keep the Ubuntu packages updated.
This tutorial will help you to update the latest packages on a Ubuntu system. You can also apply only security updates silently via the command line.
Update Ubuntu Packages
Fetch the update for all your repositories for all your apps to all the latest updates lists.
sudo apt update
Then run the upgrade command to upgrade all the packages to latest available versions.
sudo apt upgrade
Now, run the
dist-upgrade which intelligently handles changing dependencies with new versions of packages. It also removes obsolete packages from your system.
sudo apt dist-upgrade
Apply Security Updates Only
You may don’t like to update all the packages on your Ubuntu system. But we still recommend you to apply security updates to your systems. This upgrades are highly recommended for the production system to keep them secure.
Use the unattended upgrade to silently install updates without user interaction on your Ubuntu system.
sudo apt install unattended-upgrades
But, if you want to run an interactive installation or upgrade use (-d) display parameter.
sudo apt install unattended-upgrades -d
In this quick write-up, you have learned about upgrading packages on Ubuntu via the command line.