Stop apt from holding onto orphaned config files like a packrat

Package Management (Apt/Dnf/Pacman Internals)

Stop apt from holding onto orphaned config files like a packrat

🧩 The Challenge

Every time I purge an old package, I find out months later that its obscure configuration files are still cluttering up /etc, just waiting to conflict with a future install. It’s frustrating to run a clean and realize the system is still bloated with debris from software you deleted years ago.

💡 The Fix

You can use a specific dpkg command to list every package that has been removed but left its config files behind, then purge them all in one go to keep your system directory sane.

dpkg -l | grep '^rc' | awk '{print $2}' | xargs apt-get purge -y

⚙️ Why It Works

Since the ‘rc’ flag in the package status column stands for ‘remove’ and ‘config-files’, this command isolates exactly those remnants that are otherwise invisible to a standard autoremove.

🚀 Pro-Tip: Alias this as clean-configs in your .bashrc and run it after your routine system maintenance.

Linux Tips & Tricks | © ngelinux.com | 10/9/2026

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted