Site icon New Generation Enterprise Linux

Get rid of those lingering config files

Package Management (Apt/Dnf/Pacman Internals)

Get rid of those lingering config files

🧩 The Challenge

You just uninstalled a package on a Debian or Ubuntu server, right? Felt good, right? Then you reinstalled it later, or maybe just ran an audit, and found all its old config files were still hanging around in `/etc`. You thought it was gone, but nope, it left its trash everywhere. I’ve wasted hours debugging issues only to realize it was some old config from a previous install.

💡 The Fix

Next time you want a package truly gone, you need to use a different command to forcefully remove those stubborn configuration files along with the package. This ensures a clean slate, every single time.

sudo apt purge <package-name>

⚙️ Why It Works

When you `apt remove` a package, it just deletes the binaries and libraries, but purposefully leaves system-wide configuration files behind. The idea is you might reinstall it later and want your settings back. But `apt purge` goes nuclear, removing the package *and* any trace of its config files from your system. Other package managers handle config cleanup differently by default, so it’s a critical distinction on `apt`-based systems.

🚀 Pro-Tip: Run `dpkg –list | grep “^rc”` to see all packages that have been removed but still have config files left behind. Then `sudo apt purge` them.

Linux Tips & Tricks | © ngelinux.com | 11/4/2026

0 0 votes
Article Rating
Exit mobile version