How To Update Ubuntu through CLI

In this tutorial I will demonstrate how to update Ubuntu for the server version. I will also explain the difference between apt update and apt upgrade, along with a few other things you should know about updates in Ubuntu Linux.

If you are new to Ubuntu or any other Linux operating system, you might be wondering how to update your Ubuntu system for important – security patches, bug fixes and application upgrades.

Updating Ubuntu can be very simple. For a vanilla or fresh installation of Ubuntu its very simple to issue an update command in the command line.

In the terminal, you just have to use the following command:

sudo apt update && sudo apt upgrade -y
Enter your account password

As noted in the code above, you may be asked for a password depending on your permission level. If you are not in “root mode” yet you can use your account’s password to elevate yourself temporarily. You won’t see characters on the screen while typing password in the terminal, so keep on typing your password and hit enter.

That was pretty easy, wasn’t it? Let’s talk about the commands and what they do.

Technically the one line of code is not a single command, it’s a combination of two commands. The && is a way to run multiple commands in Linux in at one time.

The -y in the end automatically enters yes when the command issued asks for your confirmation before installing updates.

Note that you can also use the two commands separately, as seen below, one by one:

Sudo su
Enter Password
Apt-get update
Apt-get upgrade

It will take a little longer, because you have to wait for one command to finish and then enter the second command.

More than just OS updates

Unlike Windows,  Linux works with a package manager. When you run the updates, it updates all the packages installed via apt. This means updating Ubuntu will update the core operating system, Linux kernels as well as the applications installed from the software center (if they were apt packages) or installed using apt command.