TranslateProject/sources/tech/20180625 How To Upgrade Everything Using A Single Command In Linux.md
2018-07-13 08:46:22 +08:00

4.9 KiB
Raw Blame History

translating-----geekpi

How To Upgrade Everything Using A Single Command In Linux

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 cant upgrade everything using “sudo apt update && sudo apt upgrade” command. This command will only upgrade the applications 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 all the things in your system in one go.

You need not to run every package manager 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 and Mac OS X.

Upgrade Everything Using A Single Command In Linux

The topgrade is available in AUR. So, you can install it using Yay helper program in any Arch-based systems.

$ yay -S topgrade

On other Linux distributions, you can install topgrade utility using cargo package manager. To install cargo package manager, refer the following link.

And, then run the following command to install topgrade.

$ cargo install topgrade

Once installed, run the topgrade to upgrade all the things in your Linux system.

$ topgrade

Once topgrade is invoked, it will perform the following tasks one by one. You will be asked to enter root/sudo user password wherever necessary.

1 Run your systems package manager:

  • Arch: Run yay or fall back to pacman
  • CentOS/RHEL: Run yum upgrade
  • Fedora Run dnf upgrade
  • Debian/Ubuntu: Run apt update && apt dist-upgrade
  • Linux/macOS: Run brew update && brew upgrade

2. Check if the following paths are tracked by Git. If so, pull them:

  • ~/.emacs.d (Should work whether you use Spacemacs or a custom configuration)
  • ~/.zshrc
  • ~/.oh-my-zsh
  • ~/.tmux
  • ~/.config/fish/config.fish
  • Custom defined paths

3. Unix: Run zplug update

4. Unix: Upgrade tmux plugins with TPM

5. Run Cargo install-update

6. Upgrade Emacs packages

7. Upgrade Vim packages. Works with the following plugin frameworks:

8. Upgrade NPM globally installed packages

9. Upgrade Atom packages

10. Update Flatpak packages

11. Update snap packages

12. Linux: Run fwupdmgr to show firmware upgrade. (View only. No upgrades will actually be performed)

13. Run custom defined commands.

Finally, topgrade utility will run needrestart to restart all services. 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.

Suggested read:

Personally, I liked this 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. More good stuffs to come. Stay tuned!

Cheers!


via: https://www.ostechnix.com/how-to-upgrade-everything-using-a-single-command-in-linux/

作者:SK 选题:lujun9972 译者:译者ID 校对:校对者ID

本文由 LCTT 原创编译,Linux中国 荣誉推出