Subscribe
Home Craft apt update vs. apt upgrade: What Are the Differences?

apt update vs. apt upgrade: What Are the Differences?

by Staff
0 comment

The entire Linux ecosystem works on the concept of packages; each package on Linux is crucial for ensuring the smooth functioning of the operating system.

To update your packages on Debian and Ubuntu-based distributions, you might need to run from pillar to post, trying to figure out the best way to update all the essential software.

When looking for ways to update packages, you will come across commands like apt update, apt upgrade, and related versions. But the point is, what’s the difference between these commands, and how can you use them to update your Linux packages?

apt update vs. apt upgrade: A Comparison

Even though the apt update command might seem like the obvious go-to option to update your packages on Linux, it’s not entirely the case. The update command gives you an idea about the available updates, but it does not download or install the updates within your distro.

On the other hand, the apt upgrade command downloads and installs available updates on your machine in one go. Your Linux system has an available cache of software (packages), which contains the necessary metadata related to those packages. The metadata includes information pertaining to the version, repository, dependency, and other relevant package details.

If you don’t use the update command, you won’t refresh the cache, which would not give you a clue about the available package updates.

Here’s how to use the apt update command:

sudo apt update

The update command is almost always followed by the upgrade command which downloads the updates:

sudo apt upgrade

Once you pass the upgrade command, APT will begin downloading the software. You will get a prompt to confirm the download and installation. Type in y or yes to confirm the action.

Alternatively, you can modify the upgrade command to download and install the packages without interruption.

sudo apt upgrade -y

The -y flag provides the confirmation APT needs to perform the installation.

Finally, there is an option to use the update and upgrade functions together. The combination refreshes the cache, downloads the updates, and installs them in one go.

sudo apt update && sudo apt upgrade -y

The && operator concatenates the two commands together, followed by -y, which acts as a prespecified confirmation to update and upgrade your packages.

Understanding the apt list –upgradable Command

The apt –upgradable command works like the update command, as it lists all the possible packages available for updating. While the update command only refreshes the package cache, it does not list the available updates.

The –upgradable command, unlike the upgrade command, does not download/install the packages. Instead, you can review the available package updates and see if you want to upgrade them or not.

To get a list of all the available updates, type the following in the terminal window:

sudo apt list --upgradable

If you have Flatpak, Snap, or any other additional package manager installed on your system, you won’t see the available updates for those package managers by running the aforementioned command. This works only with APT packages.

Additionally, you need to note that the APT package manager works only within Ubuntu and Debian-based distros.

To update/upgrade packages on any other distros like Arch, Fedora, or other RPM-based distros, you need to follow a set of different commands.

Updating and Upgrading Packages on Ubuntu and Debian-Based Distros

On Linux, you must update and install the latest package versions to keep your system running smoothly.

However, despite all the latest updates and versions available, you need to have a set of essential packages installed beforehand. One of these packages is build-essential, which installs a set of compilers and other software necessary for development on Ubuntu and Debian distros.



Read the full article here

You may also like

Leave a Comment

Iman Hearts is one of the biggest lifestyle news and articles portals, we provide the latest news and articles about family, lifestyle, entertainment, and many more, follow us to get the latest news about what matters to you.

 

© 2022 Iman Hearts. All rights reserved. Sitemap