In the terminal type, the following command:
sudo apt update
After typing the above command, enter your password.
Off the bat, this command doesn’t update your system. Instead, it updates your Ubuntu repositories. So your system checks against the repositories. It checks if there are newer versions available of the program installed. It won’t update your existing packages right away; instead, it will update the information about the existing packages and their versions available. This is the reason that when this command finishes execution, Ubuntu shows you the number of packages that can be updated.
apt list --upgradable sudo apt upgrade
After typing the above command you will be asked for your password, enter and click return or enter.
Otherwise, enter
sudo apt update && sudo apt upgrade -y
The && between the two commands chains the instructions. The first part of the command 'sudo apt update' does exactly that - is run first. After this has completed its execution, the next command is executed 'sudo apt upgrade -y'. And so on the pattern continues if you have more commands. The -y at the end will save you one keystroke where Ubuntu asks you whether you want to install the upgrades or not.