Back to TILs

Cruft — Cleaning Filesystem

Date: 2019-11-17Last modified: 2023-03-07

Table of contents


cruft is a useful tool exactly for this purpose: it makes a comparison between a file system and the database of installed Debian packages. In addition to listing unknown files it also lists files which are missing but should be there.

I use it routinely together with debsums when I need to start system administration or upgrade work on machine which I did not take care of earlier. This allows me to spot any local modifications and installations and plan for them, instead of the customer telling me after an upgrade that their software does not work any more.


apt-get install cruft

List all “cruft” but ignore the named directories:

cruft --ignore "/dev /proc /sys /root /home /tmp"

More information:

man cruft
zless /usr/share/doc/cruft/README.gz