Apt-get Update Vs Upgrade [What’s the Difference]

apt-get upgrade and upgrade both commands are used in Debian-based Linux distros to update the software packages. Undoubtedly, the apt-get package management tool is great to use to perform package installation, update, removal, and so on. Therefore, to update the package information, you can use apt-get update. On the other hand, to upgrade an installed package to its latest version, run the apt-get upgrade in your Ubuntu terminal. Though both commands perform updates, their purposes are different. So to know the differences between apt-get update Vs apt-get upgrade, stick to this article.

Key Takeaways

  • Knowing about apt-get package manager.
  • Learning the uses of apt-get update.
  • Knowing the uses of apt-get upgrade.
  • Learning the differences between apt-get update vs upgrade.

Requirements

  • Must be a root user to avail of sudo privileges.

What Does Apt-get Update Do?

In the Linux system, all the information of the packages is stored in ‘/etc/apt/sources.list’ files. The apt-get update basically downloads the latest information of the packages from the source file. Thus, it updates the package index files with all necessary information along with package versions. It is recommended to run this update command before upgrading any package as it ensures that you have all the updated information available to be upgraded to the newest version.

What Does Apt-get Upgrade Do?

The apt-get upgrade automatically downloads the latest version of the packages and replaces the old version package by installing the new one. It actually updates the installed packages in your Linux system. When you wish to have some extra and modern features in your software package, upgrading the package can fulfill your desire. This command ensures that you have the latest versions of the packages that keep your system up-to-date and healthy.

Apt-get Update Vs Apt-get Upgrade

The apt-get update downloads the index files whereas the apt-get upgrade downloads the latest versions packages of the installed packages.

You can update a piece of package information with the apt-get update command. On the other hand, the apt-get upgrade command is used to install a new version package.

Downloading the most recent information from the sources.list file is the main task of the apt-get update command. However, the main task of an apt-get upgrade command is not downloading the package data but downloading the actual recent package version installed in your system.

You can run the apt-get update command when you only want to update the package details. Crontastly, use the apt-get upgrade command if you want to have a modern version software package.

Anyway, you can read the Comparative Analysis of Apt-get Update and Apt-get Upgrade section to distinguish between these two commands and pick one for your needs.

How to Use the ‘apt-get Update’ Command

Using the apt-get update command is an effortless task. Some basic steps are needed to perform this command. Don’t forget to run this command without the sudo prefix as it requires administrative permissions. Now, follow the steps mentioned below to use it properly:

Steps to Follow >

➊ Open the Ubuntu terminal.

Update the packages with the apt-get package manager by writing the following code:

sudo apt-get update
EXPLANATION
  • sudo: Permits administrative privileges.
  • apt-get: Provides a command line interface for the package management system.
  • update: Updates packages in Linux.

updating packages using apt-get

Now you have all the recent information about the packages.

How to Use the ‘apt-get Upgrade’ Command

To use this apt-get upgrade command, you just need to access the Ubuntu terminal and run the code with sudo to have administrative privileges. Check the steps below:

Note: Run the ‘apt-get update’ command before running the ‘apt-get upgrade’ to ensure that you have all the recent data of the packages.

Steps to Follow >

➊ Open the Ubuntu terminal.

➋ Now, upgrade all the installed packages with the apt-get upgrade command:

sudo apt-get upgrade
EXPLANATION
  • upgrade: Upgrades packages to the latest versions in Linux.

upgrading packages using apt-get

After you enter your Ubuntu password, the updating procedure will begin. Next, press ENTER. Now, type ‘y’ to finish the updating process. All of the packages on your Linux system are currently installed in their latest versions.

How to Use Special Options With the ‘sudo apt-get upgrade’ Command

There are multiple operations that can be done with the sudo apt-get update command. They are as follows:

Command options Description
-y or –yes Automatically answers yes to all prompts.
-s or –simulate or –dry-run Simulates the upgrade process without making any changes.
–only-upgrade Upgrades only existing packages.
-u or –show-upgraded Shows an upgraded package list.
-V or –verbose-versions Displays version information in detail.

In this table, you can see different options that can be used with the apt-get upgrade command. However, -y and –dry-run commands are the most used commands. Let’s know more about it.

How to Use the ‘–yes’ or ‘-y’ Option With apt-get upgrade Command

This command answers yes to any prompts asking your permission. Check the steps to get the benefits of it:

Steps to Follow >

➊ Open your Ubuntu terminal.

➋ Write the code to check the result:

sudo apt-get upgrade -y
EXPLANATION
  • -y: Answers yes to all prompts.

upgrading packages with '-y' option

You can notice in this picture that it has no prompt to ask your permission to proceed.

How to Use the ‘–dry-run’ or ‘-s’ Option

With the use of this command-line option, you can mimic an upgrade without executing any. It is safer to explore an upgrade before applying it because you will be able to see what would occur with an upgraded package. Check the detailed steps:

Steps to Follow >

➊ Open your Ubuntu terminal.

➋ Write the code to check the result:

sudo apt-get upgrade -s
EXPLANATION
  • -s: Simulates the upgrade process without making system changes.

simulating sudo apt-get upgrade

You can see what will happen if you do an upgrade in your terminal by looking at this image. It doesn’t alter the system; just demonstrates the process to you.

Apt or Apt-get? Which One Should You Be Using?

apt stands for Advanced Packaging tool which offers a modern interface for managing packages in Linux whereas apt-get is an outdated and low-level package management system. apt provides additional advantages that apt-get doesn’t do. Apt-get requires a command option to upgrade packages but apt can handle packages automatically. Hence, apt is more convenient to use than apt-get.

Some Examples of Apt and Apt-get

In this section, I will show you two Practical examples of using apt and apt-get package managers. First, you will get to know how the installation procedure works with these commands. Then, the removal process. Let’s get into the detail.

Example 01: Installing a Package With Apt and Apt-get

A package dependency contains all the necessary functions to operate the package successfully. Sometimes many unwanted dependencies can be downloaded with the software package during installation. To handle them, package managers are needed. Check the working procedure of the two package managers below to handle dependencies:

Steps to Follow >

➊ Open the Ubuntu terminal.

➋ Run this command to install a package with apt.

sudo apt install vlc
EXPLANATION
  • install: Installs packages in Linux.
  • vlc: Package name.

installing vlc with apt

Here, the vlc package is installed without any dependency issues.

➌ Now, install the same vlc package with apt-get:

sudo apt-get install vlc

installing vlc with apt-get

Dependency problems may arise in this installation procedure. However, to fix that, follow the next command.

➍ To fix the broken dependency, run this command:

sudo apt-get -f install vlc
EXPLANATION
  • -f: Fixes broken dependencies during package installation.

installing vlc by fixing dependency with apt-get

No dependency issues will occur after running this command.

Example 02: Removing a Package With Apt and Apt-get

During package removal with apt, it automatically removes the unused dependency along with the package but to do the same task, apt-get needs two separate commands. See the procedure in detail:

Steps to Follow >

➊ Open the Ubuntu terminal.

➋ To remove vlc package with unused dependencies, run this command:

sudo apt remove vlc
EXPLANATION
  • remove: Removes packages with unnecessary dependencies.

removing vlc with apt

Here, the vlc package along with its unused dependencies has been removed.

➌ However, apt-get removes only the package but not the dependencies. Write the following code to remove the vlc package:

sudo apt-get remove vlc

removing vlc with apt-get

After removing, it suggests running autoremove command to remove the unnecessary dependencies.

suggesting to run autoremove argument to delete unused dependency

➍ To remove the unnecessary dependencies with apt-get, run this command:

sudo apt-get autoremove
EXPLANATION
  • autoremove: Removes unused dependencies of the packages in Linux.

automatically removing unnecessary dependencies with sudo apt autoremove

All the unused dependencies of vlc have been removed now.

Comparative Analysis of Apt-get Update and Apt-get Upgrade

Here, I have explained the advantages and disadvantages of the two commands.

Commands Pros Cons
apt-get update
  • Updates Package information.
  • Downloads data from the source file.
  • Can’t download actual packages.
  • Doesn’t make any changes to the system.
apt-get upgrade
  • Installs newer version packages available in the repository.
  • Replaces outdated packages.
  • Can’t remove old packages.
  • Can’t install new packages out of system repository.

 

Both commands are useful to update packages. Before upgrading any package update must be run to ensure the most recent data of the packages. Therefore, perform both if you want to upgrade any package otherwise perform only the apt-get update command.

Conclusion

In this article, I have gone through two different package managers including apt and apt-get. I have explained how to use update and upgrade arguments with apt-get. Moreover, different important options of the apt-get upgrade command are discussed elaborately. After reading the whole content, you will be able to know the basic differences between apt-get update and upgrade and can find out which one is better on your own. Good luck!

People Also Ask

Is apt-get upgrade important?
Yes, it is. Because it will make your device up-to-date and secure by upgrading all the installed packages.
Why is apt-get upgrade so slow?
The following factors could cause the apt-get package to run slowly:
  • Mirrors problem.
  • Issue with name servers.
  • Issue with repositories.
How can I speed up my apt-get update?
Follow some instructions below:
  • Check your /etc/apt/sources. list file to see if you have the correct source repositories.
  • Remove source repositories that are undesirable or unsupported.
  • Empty the apt-get cache.
  • Select a quick DNS server.

Related Articles


<< Go Back to Upgrade Package in Linux | Package Management in Linux | Learn Linux Basics

Rate this post
Mitu Akter Mou

Hello, This is Mitu Akter Mou, currently working as a Linux Content Developer Executive at SOFTEKO for the Linuxsimply project. I hold a bachelor's degree in Biomedical Engineering from Khulna University of Engineering & Technology (KUET). Experiencing new stuff and gathering insights from them seems very happening to me. My goal here is to simplify the life of Linux users by making creative articles, blogs, and video content for all of them. Read Full Bio

Leave a Comment