Unlike Windows or macOS, where you must open individual applications (like a web browser or a text editor) and click a “Check for Updates” button inside their respective menus, Ubuntu manages almost all software centrally. This centralized system is called the Advanced Package Tool (APT).
Keeping your Ubuntu server or desktop up to date is the single most important task for maintaining system security. By running two simple commands in the terminal, you can instantly download and apply the latest security patches to the operating system kernel, background services, and all installed applications.
Step 1: Update the Package List
Before you can actually install any updates, your computer needs to know that those updates exist. To do this, Ubuntu must reach out to the official software repositories on the internet and download a fresh list of the latest available version numbers for every package.
- Open your terminal (or log into your server via SSH).
- Type the following command and press Enter:
sudo apt update - You will be prompted to enter your password because you are using
sudo(administrative privileges). Note that nothing will appear on the screen as you type your password. This is a normal Linux security feature. - The terminal will print several lines of text showing it connecting to various URLs (like
archive.ubuntu.com). - When it finishes, the last line will usually say something like: “23 packages can be upgraded. Run ‘apt list –upgradable’ to see them.”
Crucial Note: The apt update command does not install any new software. It simply refreshes the index of what is available. You must always run this command first.
Step 2: Install the Upgrades
Now that your local machine has the latest list of version numbers, you can tell it to compare that list against what is currently installed, and download the actual updates.
- In the terminal, type the following command and press Enter:
sudo apt upgrade - Ubuntu will calculate the dependencies and present you with a summary of exactly which packages are about to be upgraded, how much data will be downloaded, and how much disk space will be used.
- The terminal will pause and ask you to confirm:
Do you want to continue? [Y/n] - Type Y (or simply press Enter, as Y is the default action) to authorize the installation.
The system will now download and unpack the updates. Depending on your internet speed and the number of packages, this could take anywhere from a few seconds to several minutes.
How to Combine Both Commands (The Quick Method)
If you manage multiple servers and want to save time, you can chain the two commands together and use the -y flag. The -y flag tells APT to automatically answer “Yes” to the confirmation prompt, allowing the entire process to run without any human intervention.
Type the following and press Enter:
sudo apt update && sudo apt upgrade -y
The double ampersand (&&) ensures that the upgrade command will only run if the update command completes successfully without errors.
What About “apt-get”?
If you read older Linux tutorials online, you will frequently see commands like sudo apt-get update. While apt-get still works perfectly fine, it is an older, lower-level command. Canonical (the company behind Ubuntu) introduced the simpler apt command several years ago to be more user-friendly. For everyday updating and upgrading, always use apt.