Linux Update All Packages Command Using the CLI

How do I update all installed packages on Linux operating systems? How do I perform upgrading packages through a network on Linux operating systems?

Linux has various commands to update all installed packages. Please note that system and package updates should be performed with care. It is very important to have up to date backup before you do this. The exact command depends upon your Linux distribution:

Tutorial details
Difficulty Easy (rss)
Root privileges Yes
Requirements None
Time 1m

Linux Commands To Update All Packages

  1. Debian / Ubuntu / Mint Linux and friends try the apt-get command/apt command.
  2. CentOS / RHEL / Red Hat / Fedora Linux and friends try yum command.
  3. Suse / OpenSUSE Linux use the zypper command. We can also use graphical tool called YaST online update.
  4. Slackware Linux user try the slackpkg command.
  5. Arch Linux user try the pacman command.
  6. Gentoo Linux user try emerge command.
  7. Alpine Linux user must use apk command.

update vs upgrade in Linux

We use the update option to download package information from all configured sources such as the Internet. The upgrade option will install available upgrades of all packages currently installed on the system from the sources such as the Internet. New packages will be installed if required to satisfy dependencies, but existing packages will never be removed. If an upgrade for a package requires removing an installed package, the upgrade for this package isn’t performed. Hence, this is a safer option in all cases.

apt-get command example to update all packages on the Debian or Ubuntu Linux

Run:
$ sudo apt-get update
$ sudo apt-get upgrade


See apt-get command or apt command tutorial for more information.

yum command example to update all packages on the RHEL/CentOS/Red Hat/Fedora Linux

Execute the following command:
# yum update
See my yum command tutorial for more information.

zypper command example to update all packages on the OpenSUSE/Suse Linux

# zypper refresh
# zypper update

See our zypper command tutorial for more information.
See zypper Opensuse command tutorial or Novell SUSE Linux tutorial to update all package for more info.

pacman command example to update all packages on the Arch Linux

Arch Linux follows rolling distro model. Packages are updated frequently:
# pacman -Syu
OR
# pacman --sync --refresh --sysupgrade
See pacman package manager documentation for more information.

emerge command example to update all packages on the Gentoo Linux

We can use the emerge command as follows:
# emerge --sync
# emerge --update --deep --with-bdeps=y @world

See emerge package manager documentation for more information.

apk command for Alpine Linux

Update the terminal and then run the following apk command:
# apk update
# apk upgrade

Conclusion

You learned how to update all packages installed on various Linux distros using the CLI (command-line) options. This is useful for various reasons:

  • Fixing security bugs
  • Applying Linux kernel patches
  • Getting an updated version of app
  • Increasing performance and stability of Linux desktop or server
🐧 If you liked this page, please support my work on Patreon or with a donation.
🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
2 comments… add one
  • aref ghobadi Aug 16, 2015 @ 16:08

    Hi,
    thanks a lot
    difference between update and upgrade
    update= update software and delete Previous file
    upgrade= only upgrade software

    • Saeed Rezaee Aug 22, 2016 @ 6:08

      those are not differences ;
      the diffrences are ==>
      update => update your repository list of packages .
      upgrade => install new version of packages .
      if you wanna remove all useless package that installed in your system you should add this option -autoremove

Leave a Reply

Your email address will not be published. Required fields are marked *

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.