Ubuntu, as well as any Linux like operating system, comes with free software updates for each user. It releases operating system updates, patches and security fixes regularly for improvements in performance or fixing bugs. It is very crucial to update your Ubuntu operating system up to date because it helps to protect your system against potential vulnerabilities that can be exploited by hackers or malicious programs.
Updating Ubuntu OS is an easy process just requiring a few commands or a few clicks of a mouse. In this article, I will tell you how you can keep updated your Ubuntu OS. There are two ways to achieve this:
- Via Command line
- Via Graphical User Interface
For this article, I am using Ubuntu 18.04 LTS for describing the method.
Update Ubuntu via command line
You can update your Ubuntu OS though command line terminal application in two steps using the apt update and apt upgrade command.
Step 1: Using apt update
It updates the local database of available packages. If you do not run this, local databases will not be updated and your system will not know if some new versions are available.
Press Ctrl+Alt+T to launch a Terminal, then run the following command as sudo:
$ sudo apt update
When prompted for a password, enter sudo password.
After executing the above command, it will tell you how many packages can be upgraded.
Step 2: Using apt upgrade
Once you have updated the package database, you can upgrade the installed packages. It let you install the available upgrades of all the installed packages on the system. Apt update only updates the list of packages but does not actually install or upgrade packages. Apt upgrade actually installs the update.
Run the following command in Terminal to install the updates:
$ sudo apt upgrade
Alternatively, you can also use a single command to update and upgrade your Ubuntu OS.
$ sudo apt update && sudo apt upgrade –y
After the process finished, reboot the system just by typing reboot in the terminal.
$ sudo reboot
Update Ubuntu via Graphical User Interface
When using a desktop environment of Ubuntu, there is another option using which you can update Ubuntu that is through Graphical User Interface (GUI).
Press Windows key or Click on dash icon in the bottom left corner of the desktop to open the dash menu. Then type update keyword in the search bar. From the search results that appear, click on Software Updater.
Software Updater will check if there are any updates available for your system.
If any updates available, it will prompt with the options to install them. Click on the Install Now button to start the installation.
When prompt for the password, enter the password and click on Authenticate.
Now it will start installing the updates. Click on Details to view running update processes.
After the updates are installed, reboot the OS by typing reboot in the Terminal as sudo.
$ sudo reboot
Update commands combined
All the above commands can be combined to a single line (thank you to Chris for his suggestion). The one line command is:
$ sudo apt update && sudo apt full-upgrade -y --auto-remove && cat /run/reboo*
The command will show you at the end if a reboot is required.
List packages scheduled for the update
You can view the list of packages that have a newer version ready to be upgraded. For this, run the following command in Terminal:
$ apt list --upgradeable
Clean up after update
our system holds unnecessary packages that won’t be required after the updates. There is a command you can use to remove such packages and free up some space. The command is:
$ sudo apt autoremove
That’s all for now. Now you have learned how to update Ubuntu 18.04 LTS operating system using either of two methods via command line or via GUI.