Detecting Unused Debian Packages with Deborphan and Debfoster

The Debian package management (apt & dpkg) is great, but under certain circumstances it keeps unused packages on the system.

For example if you install package A which requires B, B is normally automatically installed. However, if you afterwards remove A, then B will be kept on the system although it could be removed because no other packages requires it.

With deborphan you can find all these packages which have no other packages depending on their installation. Another useful tool for almost the same purpose is debfoster which will ask you which of the installed packages you want to keep.

You can use the output of deborphan to remove the packages with apt.

deborphan | xargs apt-get -s -y remove

Hope the two tools help you to keep a clean Debian install.