Removing unwanted config files in apt based distros

Date: 23 Dec, 2010
Posted by: admin
In: hints & tips|linux, open source & software

Bookmark and Share

Just discovered deborphan and have used it to clean up some cruft from my Kubuntu system, this should work for any .deb based system that uses apt.

Removing unwanted packages

List packages with no dependencies

deborphan -a -n -z | sort -nr

Will give you a list sorted by install size (-n) with largest first (-r) of all (-a) packages with no dependencies, ignoring recommendations and suggestions (-n) and listing the sizes (-z). This is a useful list to work through and see if the packages are needed or not. There is also a gtkorphan package that allows for removal directly but it has a few dependencies so I stuck with the console version ;0)>

Remove unwanted config files

for i in $(deborphan --find-config) ; do sudo aptitude -y purge $i ; done

This looks at the list of orphaned configuration files, picks the package name and then uses aptitude to purge the config files. I just wrote this up myself so check it, no warranty, YMMV. I used the highlighted -y flag on aptitude to skip being asked if I want to purge each package but this is probably not wise. Do a dry run first without this.

Note that the orphaned config files are for packages that are no longer installed according to deborphan, if somehow it got the installation status wrong then you’d be removing wanted files, take care.

You can also get orphaned config file information from dpkg --list:


rc rarian-compat 0.8.1-4ubuntu1 Documentation meta-data library (compatibility tools)
ii readline-common 6.1-1 GNU readline and history libraries, common files
ii rsync 3.0.7-1ubuntu1 fast remote file copy program (like rcp)
ii rsyslog 4.2.0-2ubuntu8.1 enhanced multi-threaded syslogd
rc rtkit 0.6-0ubuntu1 Realtime Policy and Watchdog Daemon
rc screen-resolution-extra 0.13 Extension for the GNOME screen resolution applet
ii sed 4.2.1-6 The GNU sed stream editor
ii sensible-utils 0.0.1ubuntu3 Utilities for sensible alternative selection
ii sgml-base 1.26 SGML infrastructure and SGML catalog file support
rc sgml-data 2.0.4 common SGML and XML data
ii shared-desktop-ontologies 0.3-1 shared ontologies for semantic searching
ii shared-mime-info 0.71-1ubuntu2 shared MIME database and spec
ii softbeep 0.3-19 System bell replacement
rc software-properties-gtk 0.75.10 manage the repositories that you install software from
ii software-properties-kde manage the repositories that you install software from
ii soprano-daemon 2.4.2+dfsg.1-0ubuntu1.1 daemon for the Soprano RDF framework
ii ssl-cert 1.0.23ubuntu2 simple debconf wrapper for OpenSSL
ii sudo 1.7.2p1-1ubuntu5.2 Provide limited super user privileges to specific users
rc synaptic 0.63.1ubuntu6 Graphical package manager
rc system-config-printer-com 1.2.0+20100408-0ubuntu5 Printer configuration GUI
ii systemsettings 4:4.4.2-0ubuntu14 KDE 4 System Settings
ii sysv-rc 2.87dsf-4ubuntu17 System-V-like runlevel change mechanism
ii sysvinit-utils 2.87dsf-4ubuntu17 System-V-like utilities


Hope that helps.

Other ways to find orphaned files

Mariuz’s blog – – gives info about printing a graph showing deps for a package using debtree and dot commands.

Sorry, comments are closed.


Flapjacktastic is just a random collection of musings, hints&tips, notes, information ... a collection of stuff really that's overflowed from the brain of this husband, father, potter, business-man, geek ...

past posts