If you have been using Ubuntu and Linux Mint for a while, you might be aware of how to keep your system up to date by graphical user interface method (GUI) using the corresponding Package Manager. Ubuntu users need to use the Ubuntu Software Center, and Linux Mint users can use the Update Manager to keep the system updated with official security fixes and updated apps.
In this beginner’s tutorial, we shall see how to install the same updates by using the command-line method via the Terminal instead of the GUI way. This is typically the first step to go command-line on the approach to learning Linux.
Install Updates on Ubuntu, Linux Mint, and elementary OS from the Terminal
Launch the Terminal App. On Ubuntu, you can do this by going to the “Activities” menu and looking for “terminal” in the search box. You can also use the Ctrl+Alt+T keyboard combination.
Step 1: Update your system’s repository using the apt-get update command. You must enter the admin password when prompted.
sudo apt-get update
Step 2: Once the repo is updated, it’s time to now fetch the updates from the official server and also apply the updates. The apt-get upgrade command will never remove the currently installed packages. New versions of currently installed packages that cannot be upgraded will be left at their current version. Use the apt upgrade command:
sudo apt-get upgrade
That’s it; your system should be updated by now!
[Tip] Using Distribution Upgrade
There is yet another command that you can use instead of apt-get upgrade command. It’s the apt-get dist-upgrade. This command intelligently handles changing dependencies with new versions of packages.
It will attempt to upgrade the most important packages at the expense of less important ones if necessary, to prevent broken installations. The dist-upgrade command may, therefore, remove some outdated and broken packages. You can use it when “Step 2” ends up with an error.
sudo apt-get dist-upgrade
Installing only the security updates
Some times to save time while administrating the remote machines, you may want to launch Terminal and only install the security updates.
You can use the unattended upgrade command, which will silently install updates without user interaction.
sudo apt-get install unattended-upgrades
Instead, if you want to have an interactive installation, use the display parameter:
sudo apt-get install unattended-upgrades -d