It is recommended for all Linux system users to keep packages up to date. All the Linux distributions provide security and package 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
Use the ‘apt update‘ command to download the package information from all the configured sources from all repositories on your system.
sudo apt update
Then run the upgrade command to upgrade currently installed packages to the latest available versions from the configured sources.
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 apply security updates to your systems. These 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 the (-d) display parameter.
sudo apt install unattended-upgrades -d
Conclusion
In this quick write-up, you have learned about upgrading packages on Ubuntu via the command line.
2 Comments
Thanks for this. exactly what I needed 🙂
Dear Rahul, thanking you for the job well done.
Your writings are understandable, pricise and straight to the point.
Wishing you success.
Sincerely
Makhaya Pule Maqekoane