How to install security updates from the command line in Ubuntu

How To Install Security Updates From The Command Line In Ubuntu
How To Install Security Updates From The Command Line In Ubuntu
Installing security updates only

Installing updates using the command line from the Terminal is done by using the apt update and upgrade command. For those who aren’t aware of it, check the step-by-step tutorial we published earlier.

The apt update and upgrade command install all the updates including the software updates and the official security updates. In case you only want to install just the security updates and not all the application updates, you can do that too. Here is how:

This tutorial is tested on Ubuntu 18.04, but should work without any issues in other Ubuntu derivatives including Linux Mint, elementary OS, and others.

Step 1) Launch the Terminal.

Step 2) You can check if any security updates are available by using the following command:

sudo unattended-upgrade --dry-run -d

Note the usage of the dry run. It means the update check is only a simulation. Nothing will be downloaded or installed. -d is used to display the result in the terminal.

Step 3) In the above command if you see “No packages found that can be upgraded unattended and no pending auto-removals” in the Terminal, this implies your PC is up-to-date. If you see updates available, you can install them by using the below command:

sudo unattended-upgrade -d

That’s it! Hope you learned something new today at FOSS Linux. Have a good one.