Updating software packages using apt (for Debian-based systems like Ubuntu) or yum (for Red Hat-based systems like CentOS) is a basic but essential Linux command-line task. Here’s how you do it for each:
For Debian/Ubuntu (APT-based)
| sudo apt update | # Updates the package list (metadata) |
| sudo apt upgrade | # Installs the newest versions of installed packages |
~Optional but useful:-
| sudo apt full-upgrade | # Also handles package removals or new dependencies |
| sudo apt autoremove |
For RHEL/CentOS/Fedora (YUM-based)
| sudo yum check-update | # Checks for available updates |
| sudo yum update | # Updates all packages to the latest version |
Optional:
| sudo yum upgrade | # Similar to update, may replace old packages |
| sudo yum autoremove | # Removes unused packages (if supported) |
Note: On newer RHEL/Fedora systems, dnf is the successor to yum. Commands are similar:
sudo dnf update
