As we all know already, keeping our Linux system up-to-date involves invoking more than one package manager. Say for instance, in Ubuntu you can't upgrade everything using "sudo apt update && sudo apt upgrade" command. This command will only upgrade the packages which are installed using APT package manager. There are chances that you might have installed some other applications using cargo, pip, npm, snap, flatpak or Linuxbrew package managers. You need to use the respective package manager in order to keep them all updated. Not anymore! Say hello to "topgrade", an utility to upgrade everything using a single command in one go.
You need not to run every package manager separately to update the packages. The topgrade tool resolves this problem by detecting the installed packages, tools, plugins and run their appropriate package manager to update everything in your Linux box with a single command. It is free, open source and written using Rust programming language. It supports GNU/Linux, Mac OS X, FreeBSD and Microsoft Windows.
$ yay -S topgrade
On other Linux distributions, topgrade can be installed Cargo package manager. To install cargo package manager, refer the following link.
And, then run the following command to install topgrade:
$ cargo install topgrade
If cargo method doesn't work for any reason, download the latest topgrade binary from releases page. As of writing this guide, the latest version was 2.2.0.
$ wget https://github.com/r-darwish/topgrade/releases/download/v2.2.0/topgrade-v2.2.0-x86_64-unknown-linux-gnu.tar.gz
Extract the tar file:
$ tar xvf topgrade-v2.2.0-x86_64-unknown-linux-gnu.tar.gz
Copy or move the topgrade binary file to your path, for example /usr/local/bin/.
$ sudo mv topgrade /usr/local/bin/
Check if it is correctly installed as shown below.
$ which topgrade /usr/local/bin/topgrade
Check installed version:
$ topgrade -V Topgrade 2.2.0
Upgrade Everything Using Topgrade In Linux And Unix
Once installed, run topgrade utility to upgrade all the things in your Linux system.
Once topgrade is invoked, it will perform the following tasks one by one depending upon the OS you use. You will be asked to enter root/sudo user password wherever necessary.
1. Run your Linux system's package manager and do the following operations:
- Arch based: Run yay or fall back to pacman
- Redhat based: Run
- Debian based: Run
apt update && apt dist-upgrade
- Gentoo: Run
layman -s ALL && emerge --sync -q && eix-update && emerge -uDNa world
- openSUSE: Run
zypper refresh && zypper dist-upgrade
- Void: Run
2. Run etc-update.
3. Run unofficial and third-party package managers:
- Update Flatpak packages
- Update snap packages
- Run fwupdmgr to show firmware upgrade. (View only. No upgrades will actually be performed)
rpi-updateto update Raspberry Pi Firmware
- Run pihole updater
- Update Rustup by running
rustup update. This will also attempt to run
rustup self updatewhen Rustup is installed inside the home directory.
- Run Cargo install-update
- Upgrade Emacs packages
- Upgrade OCaml packages
- Upgrade vcpkg globally installed packages
- Upgrade myrepos managed sourcecode repositories
- Upgrade Python packages installed using pipx
- Upgrade R globally installed packages
- Upgrade Vim/Neovim packages. Works with the following plugin frameworks:
yarn global updateif yarn is installed.
npm update -gif NPM is installed and
npm root -gis a path inside your home directory.
composer global updateif Composer's home directory is inside the home directory of the user. Run
- Upgrade Atom packages
gem upgrade --user-installif
brew update && brew upgrade. This should handle both Homebrew and Linuxbrew.
nix upgrade-nix && nix --upgrade.
- Run Pearl
- Run zplug update
- Upgrade tmux plugins with TPM
- Upgrade and audit packages.
Miscellaneous (These steps will be performed on all OS)
It will check if the following paths are tracked by Git. If so, pull them:
- Powershell Profile
- Custom defined paths
Once all packages are upgraded, Topgrade will do one more final step.
Topgrade utility will run needrestart to restart all services.
Topgrade will run
In Mac OS X, it will upgrade App Store applications.
Sample output from my Ubuntu 18.04 LTS test box:
The good thing is if one task is failed, it will automatically run the next task and complete all other subsequent tasks. Finally, it will display the summary with details such as how many tasks did it run, how many succeeded and how many failed etc.
- How To Upgrade Ubuntu With A Single Command
- 3 Different Methods To Upgrade Ubuntu To Latest Version
- Install Updates And Security Patches Automatically In Ubuntu
Tograde comes with a few options to perform various additional tasks.
Run Topgrade inside Tmux sessions
This is handy when you use Topgrade on the remote systems.
To start Topgrade inside a Tmux session, use -t flag.
$ topgrade -t
Remove old and unnecessary files
To instruct package managers to clean up old and unused files, use -c flag with topgrade:
$ topgrade -c
Disable specific upgrade steps
Sometimes, you don't want to upgrade a specific package. If so, you can use
For instance, skip system upgrade using command:
$ topgrade --disable system
This command will only skip the system upgrade phase and upgrade everything else as usual.
―― 11:39:48 - Self update ―――――――――――――――――――――――――――――――――――――――――――――――――――――― Topgrade is up-to-date ―― 11:39:50 - rustup ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― info: checking for self-updates info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu' info: checking for self-updates stable-x86_64-unknown-linux-gnu unchanged - rustc 1.35.0 (3c235d560 2019-05-20) ―― 11:39:52 - Node Package Manager ――――――――――――――――――――――――――――――――――――――――――――― ―― 11:40:08 - Summary ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― Git repositories: OK rustup: OK NPM: OK
Skip Emacs upgrade:
$ topgrade --disable emacs
This command will skip upgrading Emacs packages and its configuration files.
Skip Vim upgrade:
$ topgrade --disable vim
Skip gem upgrade:
$ topgrade --disable gem
For more details, check the help section by running the following command:
$ topgrade --help Topgrade 2.2.0 Roey Darwish Dror <[email protected]> Command line arguments USAGE: topgrade [FLAGS] [OPTIONS] FLAGS: -c, --cleanup Cleanup temporary or old files -n, --dry-run Print what would be done -h, --help Prints help information --no-retry Do not ask to retry failed steps -t, --tmux Run inside tmux -V, --version Prints version information -v, --verbose Output logs OPTIONS: --disable <disable>... Do not perform upgrades for the given steps [possible values: gem, git-repos, vim, emacs, system]
Personally, I liked the idea of creating an utility like topgrade and upgrade everything installed with various package managers with a single command. I hope you find it useful too.