Home » Linux » Shell » How To Update Ubuntu

How to Update Ubuntu Linux [Server and Desktop]

If you’re running Ubuntu Linux on your desktop, you’ll be regularly prompted to update using the built-in update tool. But what if you’re on Ubuntu Server or want to check for and run any pending updates manually?

This tutorial covers the steps required to update your Ubuntu Linux OS on Desktop and Server. But first, some relevant articles:

apt vs. apt-get Commands – What’s the Difference?

Checking Your Operating System Version in Ubuntu Linux with ‘lsb_release.’

Preamble

All package management functions should be run using the sudo command – as they require root privileges. After each command is run, you will see a list of changes that must be made that must be confirmed by typing y/n to continue.

Step 1: Updating Package Lists

To know if you need to update, you need to know if there are updates – run the following to update the lists of packages on your computer so that updates can be calculated:

sudo apt update
sudo apt update
sudo apt update

Step 2: Upgrading Packages

Now we know if there are new versions available, we can update to them with the following command:

sudo apt upgrade

apt upgrade won’t install any new dependencies or remove any old ones if an update requires them. If you want to upgrade and have your dependencies managed smartly, run:

sudo apt dist-upgrade
sudo apt upgrade
sudo apt upgrade

My system is updated regularly, so there’s nothing to update!

Removing Packages That Are No Longer Required

If you have only run apt upgrade and some packages are no longer required, that were installed as dependencies of other packages, they will have been left behind. They can be cleaned up by running:

sudo apt autoremove
sudo apt autoremove
sudo apt autoremove

Here’s what it looks like when apt prompts you to confirm changes

SHARE:
Photo of author
Author
I'm Brad, and I'm nearing 20 years of experience with Linux. I've worked in just about every IT role there is before taking the leap into software development. Currently, I'm building desktop and web-based solutions with NodeJS and PHP hosted on Linux infrastructure. Visit my blog or find me on Twitter to see what I'm up to.

Leave a Comment