How to Upgrade With “sudo apt-get” Command [2 cases]

LINUX
FUNDAMENTALS
A Complete Guide for Beginners Enroll Course Now

apt-get is one of the popular package managers used to perform different operations including install, remove, update, and upgrade in Debian-based Linux derivatives. It can automatically upgrade any package to its latest versions available. To upgrade all packages on a Debian-based system, just run this sudo apt-get upgradewhile for specific packages, you would execute sudo apt-get upgrade <package-name> in your terminal. Stay connected to know more about it.

2 Cases to Upgrade Packages Using “sudo apt-get” in Linux

In this section, I have explored two different cases to upgrade packages in Linux. If you want to upgrade all the packages with a single command, follow Case 01. Otherwise, to upgrade a specific package, you can check Case 02.

1. Upgrade All Packages With the “sudo apt-get” Command

It is always recommended to upgrade your packages daily to have a smooth work environment. As it is not such tiresome work, you can do it easily with a simple command in Ubuntu. In order to do that, follow the below steps carefully:

  1. Open the Ubuntu terminal.
  2. Update the packages before upgrading  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 in linux using apt-get

  3. Now, upgrade all the installed packages with the apt-get command:
    sudo apt-get upgrade
    EXPLANATION
    • upgrade: Upgrades packages to the latest versions in Linux.

    upgrading all the old version packages with sudo apt-get upgrade

    The upgrading process will start after you type your Ubuntu password. Then click ENTER. After that, write ‘y’ to complete the upgrading procedure. Now, you have the updated versions of all the packages installed in your Linux system.

2. Upgrade a Specific Package With the “sudo apt-get” Command

You can also upgrade a specific package whichever you want with a single command using apt-get. Here, I will show you how to upgrade an old version Google Chrome package:

  1. Open the Ubuntu terminal.
  2. It is important to update the packages before upgrading any package. You can check Case 01 Step 02 to update all the installed packages with the apt-get package manager.
  3. Now write this command to upgrade the Google Chrome package:
    sudo apt-get upgrade google-chrome-stable
    EXPLANATION
    • google-chrome-stable: Package name.

    upgrading google chrome package

    When you type ‘y’, it automatically installs the updated version package of Google Chrome.

Conclusion

Now you are capable enough to upgrade packages in Linux. Remember that, it is a healthy practice to update packages before upgrading them. In this article, I have explained two practical cases about upgrading packages. All the packages can be upgraded at once. In addition, a single package can be upgraded with the apt-get. You must have the sudo privileges to execute these commands. Always keep your device up-to-date and healthy. Bye.

People Also Ask

What is the difference between sudo apt-get update vs upgrade?

The sudo apt-get update command updates the local package index with the latest versions of available packages from the repositories. It does not update the installed packages; instead, it updates the information about the available packages and their version.

The upgrade command, on the other hand, updates all installed packages to the latest version. It gets the latest versions of the packages from the list updated by apt-get and installs them on the system. This command ensures that the system has the latest version of all installed packages. It also fixes bugs, patches security issues, and adds new features as needed.

How to upgrade a package with ‘sudo apt-get’?

To upgrade packages with sudo apt-get, you can run the sudo apt-get upgrade <package_name> command.

What does ‘sudo apt-get upgrade’ do?

The sudo apt-get upgrade upgrades packages to their latest versions by replacing the old ones.

How do you upgrade apt?

To upgrade the APT (Advanced Package Tool) itself, you can use the following command: sudo apt-get install --only-upgrade apt. This command installs the latest version of the APT package, ensuring that you have the most up-to-date version of the package management system on your system.

What is the sudo apt-get update command?

The sudo apt-get update command updates the local package index with the latest versions of available packages. It downloads the package lists from the repositories specified in the system’s sources.list file. This command does not upgrade the installed packages; it merely updates the information about available packages and their versions.

How long does sudo apt upgrade take?

The duration of sudo apt upgrade varies based on factors like package size and internet speed, typically ranging from seconds to minutes.

Related Articles


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

5/5 - (10 votes)
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