Package Management
Package Management
6 interactive questions
`apt update` vs `apt upgrade` vs `apt install`?
apt update refreshes the package index (metadata) from repos. apt upgrade installs available upgrades for already installed packages. apt install <pkg> fetches and installs a new package with dependencies. ⚠️ Always update before upgrade/install.
`dpkg` vs `apt`?
dpkg is the low-level tool that installs .deb files directly (no dependency resolution). apt is the high-level front-end that resolves deps, downloads from repos, and calls dpkg. Use apt for daily work; dpkg -i file.deb for local files.
How do you find which package owns a file?
dpkg -S /path/to/file (Debian/Ubuntu) or rpm -qf /path/to/file (RHEL/Fedora).
What is a PPA?
Personal Package Archive — a Launchpad-hosted repo for Ubuntu. add-apt-repository ppa:user/ppa adds it, then apt update. ⚠️ Third-party; verify trust before adding.
How do you hold a package at a specific version?
apt-mark hold <pkg> prevents upgrades. apt-mark unhold <pkg> releases it. apt-mark showhold lists held packages.
How do you clean up apt cache?
apt clean removes all .deb files from /var/cache/apt/archives/. apt autoclean removes only obsolete (uninstallable) packages. apt autoremove removes auto-installed deps no longer needed.