Auditing What's Actually Installed

Chapter 10 · Final Chapter
Practical Workflows
Auditing what's installed, cleaning up unused dependencies, and keeping a system safely up to date — the routine maintenance habits worth having

This final chapter pulls together every command from the previous nine into a small set of habits genuinely worth running periodically — on Philip's actual Debian server and Raspberry Pi, and on any RPM-based system encountered along the way.

Auditing What's Actually Installed

$ # apt — full list with version numbers
$ apt list --installed

$ # dnf — equivalent
$ dnf list installed

$ # Manually installed packages only — excludes anything pulled in purely as a dependency
$ apt-mark showmanual

apt-mark showmanual is genuinely useful for understanding what you actually chose to install over time, versus the much larger set of dependencies pulled in automatically alongside those choices — a clearer picture of a system's real, deliberate software footprint.

Finding and Removing What's No Longer Needed

$ # Orphaned dependencies — Chapter 2/5's autoremove, worth running periodically
$ sudo apt autoremove
$ sudo dnf autoremove

$ # Clear cached .deb/.rpm files no longer needed after install
$ sudo apt clean
$ sudo dnf clean all
apt clean vs apt autoremove — genuinely different things, often run together
autoremove removes orphaned packages that are no longer needed at all. clean removes cached download files (the .deb files themselves, already installed, sitting in /var/cache/apt/archives/) that served their purpose and are just consuming disk space now. Running both periodically keeps a system genuinely lean rather than slowly accumulating cruft.

A Safe, Repeatable Update Routine

$ # A sensible weekly/monthly routine for a Debian-based server
$ sudo apt update
$ sudo apt upgrade
$ sudo apt autoremove
$ sudo apt clean

Unattended Security Updates — Worth Knowing About, Even If Not Always Used

$ sudo apt install unattended-upgrades
$ sudo dpkg-reconfigure unattended-upgrades

Configures security updates to apply automatically, without manual intervention — a real trade-off between staying patched against known vulnerabilities promptly versus the small risk of an automatic update introducing an unexpected problem on a system you weren't actively watching at the time.

Always check what's about to happen before a major version upgrade (e.g. Debian 12 → 13)
A routine apt upgrade is low-risk; a full distribution upgrade between major releases is a genuinely bigger event — back up critical data first, read the release notes for known breaking changes, and consider testing on a non-critical system or VM before applying it to something like a production server.

A Final, Complete Maintenance Checklist

Refresh package lists before any install/upgrade
apt update, or rely on dnf's automatic metadata refresh — Chapters 2 and 5.
Periodically audit what's actually installed
apt-mark showmanual / dnf list installed — understand your system's real footprint.
Clean up orphaned dependencies and cached download files regularly
autoremove + clean — keeps disk usage and package count from slowly creeping up.
Only add third-party repositories from genuinely trusted sources
Remember Chapter 3/6 — every added repository is effectively trusted with root access.
Know the troubleshooting sequence before something actually breaks
dpkg --configure -a → apt --fix-broken install, or dnf's equivalents — Chapter 8.

Chapter 10 Quick Reference — and Course Wrap-Up

  • apt list --installed / dnf list installed — full installed-package audit
  • apt-mark showmanual — what you actually chose to install, excluding auto-pulled dependencies
  • autoremove — removes orphaned packages; clean — removes cached download files; genuinely different, often run together
  • Sensible routine: update → upgrade → autoremove → clean, run periodically
  • unattended-upgrades — automates security patching, a real convenience-vs-control trade-off
  • Major version upgrades deserve more caution than routine upgrades — back up, read release notes, test first
  • Course recap: concepts (Ch1) → APT (Ch2) → Debian repos (Ch3) → dpkg (Ch4) → RPM/dnf (Ch5) → RedHat repos (Ch6) → rpm (Ch7) → troubleshooting (Ch8) → snap/flatpak/pacman (Ch9) → maintenance workflows (Ch10)
  • The throughline across both families: a friendly front end (apt/dnf) for dependency-aware everyday use, a low-level engine (dpkg/rpm) underneath for direct inspection and repair