How to find files in a Debian system not installed or created by dpkg?

Solution 1:

Use the cruft package:

cruft is a program to look over the system for anything that shouldn't be there, but is; or for anything that should be there, but isn't.

Solution 2:

You could try something like this:

dpkg -L --list-all-package-files | grep "^/usr" > dpkg-files.dat   **(don't know the dpkg option "--list-all-package-files", read mand dpkg)**
find /usr -type f -o -type l > all-usr-files.dat
sort dpkg-files.dat all-usr-files.dat | uniq -c | grep " 1 "

This way you will get all files that are in /usr but not any package file. As a first shot this could help you.