How to Update Ubuntu Using Command Line

By default Ubuntu 20.04 LTS installs with no GUI meaning that updates have to managed via terminal.

When connecting to your Ubuntu installation using terminal you may be used to seeing a similar message to the below as part of the welcome screen.

This is one of your indications that updates are available to either the operating system or the packages installed.

There are a couple of different commands that will come in really handy when managing your updates:

Update Commands

apt list --upgradable

This will give you a list of the currently available updates as shown below.

sudo apt-get update

apt-get update will synchronise your packages with repositories via the internet.

sudo apt-get upgrade

apt-get upgrade will apply any updates to packages that you have installed.

sudo apt-get install package-name

apt-get install package-name will install one of more packages named in the command, if the packages are already installed an update to the latest version will be attempted. (example, sudo apt-get install apache php5 mysql-server will install apache, php5 and mysql-server packages)

sudo apt-get dist-upgrade

sudo apt-get dist-upgrade will perform updates to the kernal.

Post Install

Whilst not always necessary, a post update reboot can be completed by using the command:

sudo reboot

Why updates are so important

Keeping machines of any operating systems up-to-date is a key task to keep on top of security vulnerabilities that may have been unearthed in existing versions of the operating systems or packages. These are usually patched in new versions so the newer the version you can run, usually the better.

On top of this security aspect newer versions usually come with new feature releases which may make your workflows more efficient or even allow new ones to be created.

Leave a Reply

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