Package managers install software with dependencies and security updates; manual installs rot.
Distributions ship software as packages from signed repositories. The package manager resolves dependencies, installs files, records what owns each file and later upgrades everything together, including security fixes. That is why the first answer to "how do I install X" should be the package manager.
On Debian and Ubuntu (apt, .deb):
sudo apt updaterefreshes the package lists (do this first),sudo apt install pkg,sudo apt remove pkg(purgealso deletes config),sudo apt upgrade,apt search term,apt show pkg,dpkg -L pkglists a package's files,dpkg -S /pathfinds the owner of a file.
On Fedora, RHEL, Rocky and Alma (dnf, .rpm): sudo dnf install pkg, dnf remove, dnf upgrade, dnf search, dnf provides /usr/bin/dig and rpm -ql pkg. Others: pacman -S on Arch, apk add on Alpine, zypper on SUSE.
Extra repositories (PPAs, EPEL, vendor repos for Docker or PostgreSQL) add software the distribution does not carry; only add sources you trust, since packages install as root. Universal formats like Snap and Flatpak bundle dependencies for desktop apps. Language package managers (pip, npm) should not write into system directories: use virtual environments or per-user installs.
Example
# Debian / Ubuntu
sudo apt update # refresh package lists first
sudo apt install -y htop # install with dependencies
apt search ripgrep # find packages
apt show nginx | head -n 5 # version, size, description
sudo apt upgrade # update everything installed
sudo apt remove htop # purge would also delete its config
dpkg -L curl | head -n 3 # files installed by a package
dpkg -S /usr/bin/ssh # openssh-client: /usr/bin/ssh
# Fedora / RHEL
sudo dnf install htop
dnf provides /usr/bin/dig # which package ships a file
# Arch: sudo pacman -S htop Alpine: apk add htopRemember
- apt update before apt install; dnf on the RPM side
- dpkg -S / dnf provides find which package owns a file
- Prefer distribution packages; add only trusted repositories
Watch out for
- Installing with
sudo pip installinto the system Python and breaking OS tools.