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 level Easy
Root privileges Yes
Requirements None
Est. reading 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

$ 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
# 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


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

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 2 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf duf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Modern utilitiesbat exa
Network UtilitiesNetHogs dig 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 glances gtop jobs killall kill pidof pstree pwdx time vtop
Searchingag grep 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

    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.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum