Upgrade Various Kinds of Packages in Linux at Once With Topgrade

Here's how you can upgrade various packages in Linux at once, using a nifty tool i.e topgrade.
Warp Terminal

Updating a Linux system is not that complicated, is it? After all, to update Ubuntu-like distros, you just have to use apt update && apt upgrade.

That would have been the case if all the packages had been installed through a single package manager.

But that’s not the case anymore. You have the classic apt/dnf/pacman and then come Snap, Flatpak, and AppImage files. It doesn’t end here...

You may also install applications using PIP (for Python) and Cargo (for Rust) as well.

Use Node.js? The npm packages need to be updated separately. And, Oh My Zsh? It needs to be updated separately too.

Plugins in Vim, Atom, etc, may also not be covered by apt/dnf/pacman.

Do you see the problem now? It may not be convenient to update all packages in your system. This is the problem a new tool called topgrade aims to solve.

Topgrade: A single utility to take care of all kinds of updates

This topgrade is a CLI utility that detects which tools you use and then runs the appropriate commands to update them.

topgrade disable system

Apart from the usual Linux package managers, it can detect and update brew, cargo, PIP, pihole, Vim and Emacs plugins, R packages etc.

You can explore its GitHub page to know more.

📋
The original topgrade tool has been discontinued. We have updated the article with the link to its active fork, which works the same way.

Key Features of Topgrade:

  • Ability to update packages from different package managers, including firmware!
  • You do have control over how you want to update packages.
  • Extremely customizable.
  • Ability to have an overview even before updating packages.

So without wasting any time, let’s jump to the installation.

Install Topgrade in Linux using Cargo

The installation process is quite straightforward as I’m going to use the cargo package manager.

We already have a detailed guide with multiple methods for setting up a cargo package manager So I’m going to make it quick by using Ubuntu in my example.

So let’s start with some dependencies and installation of cargo in the least extensive way:

sudo apt install cargo libssl-dev pkg-config

Once the cargo has been installed, utilize the given command to install topgrade:

cargo install topgrade

And it will throw a warning as given:

cargo error

Where you just have to add the path of cargo to run binaries. This can be done through given command where you’ve to change sagar with your username:

echo 'export PATH=$PATH:/home/sagar/.cargo/bin' >> /home/sagar/.bashrc

Now, reboot your system and topgrade is ready to use. But wait, we need to install another package that will update cargo to get the most recent packages.

cargo install cargo-update

And we’re done with installation.

Using Topgrade

Using topgrade is extremely easy. Use a single command and that’s it:

topgrade

But this won’t give you any control apart from system packages, but as I mentioned, you can blacklist the repo you don’t want to get updated.

Exclude package managers and repositories from Topgrade

Let’s suppose I want to exclude snaps and packages downloaded from the default package manager, so my command would be:

topgrade --disable snap system
topgrade disable snap system

For making a permanent change, you’d have to make a few changes in its config file which can be accessed through the given command:

topgrade --edit-config

For this example, I discluded snaps and default system repo:

configuring topgrade

Dry run topgrade

Having an estimation of outdated packages that will be updated is always a good idea and I find this most useful option from the entire catalog of topgrade.

You just have to use topgrade with -n option and it will generate a summary of outdated packages.

topgrade -n
summery of topgrade

A neat way of checking packages that need to be updated.

Final Words

After using Topgrade for a few weeks, it became an integral part of my Linux arsenal. Like most other Linux users, I only updated packages through my default package manager. Python and Rust packages were ignored completely. Thanks to topgrade, my system is updated entirely now.

I understand that this is not a tool everyone would want to use. What about you? Willing to give it a try?

About the author
Sagar Sharma

Sagar Sharma

A software engineer who loves to write about his experience with Linux. While reviving my crashed system, you can find me reading literature, manga, or watering my plants.

It's FOSS

Making You a Better Linux User

It's FOSS

Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to It's FOSS.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.