Updating your system
Keep packages and security patches current β the exact command depends on your distro's package manager.
Why this matters
Distros ship security fixes through their package manager, not a single OS-wide updater like desktop operating systems. Running the update command regularly (or enabling unattended upgrades) is the single highest-value thing you can do for a server's security.
Debian & Ubuntu (APT)
Refresh the package index, then upgrade. autoremove clears packages nothing depends on anymore.
sudo apt update
sudo apt upgrade -y
sudo apt autoremove -yRHEL, Rocky, AlmaLinux & Fedora (DNF)
dnf resolves and applies updates in one step; check-update alone just lists what's available without installing.
sudo dnf check-update
sudo dnf upgrade -yopenSUSE (Zypper)
refresh updates repo metadata, update applies available package updates.
sudo zypper refresh
sudo zypper update -yAlpine (APK)
update refreshes the index, upgrade installs newer versions of everything already installed.
sudo apk update
sudo apk upgradeArch (Pacman)
Arch is a rolling release β -Syu syncs repos and upgrades the whole system in one command. Run it often; long gaps between updates make partial upgrades more likely to break something.
sudo pacman -Syu