Artificial intelligent assistant

Tool to remove all non-package files on a system If you want to keep for example a build or server system clean, it is very useful to be able to **check that all files are present and accounted for** by the package metadata. At work we have a very nice tool which, if run without any parameters, simply creates a file with `rm`/`rmdir` statements for any and all files/directories not mentioned by any package (excluding some trees like `/home`). This is _different_ from `rpm -V` and `debsums`, which only check the files already mentioned by a package. Is there a tool like this for DEB/RPM/Ports/other packaging systems? DEB would be the best, but porting from another system (or our own, if nothing else exists) would probably be feasible. PS: I am _not_ looking for alternative architectures. The issue here is to have absolutely every file on the system accounted for. VMs and such are not applicable.

If what you want is a file integrity checker, then RPM will do what you want. `rpm -qaV`(note the uppercase V). That will go through and check:

* file size
* mode(permission and file type)
* MD5 checksum
* device number(checks if someone's hiding a file by mounting another partition there
* readlink path(if the symlink points to a different file)
* user ownership
* group ownership
* modification time



That should be a fairly comprehensive list.

`rpm -qa --filesbypkg | awk '{print $2}'` will list all the files on the system that have been accounted for.
`find / | grep -vf /tmp/files-on-system.txt` will find all files on the system that are not in the RPM database. Another way of accomplishing these two commands in one command would be `rpm -qf 'find /'#replace single quote with backtick` **NOTE: This will also flag as erroneous files in directories like

* `/dev`
* `/home`
* `/proc`
* `/var/run`
* `/var/log`
* `/var/lib`
* `/tmp`**

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy c8113749447dd1a11c4d9e93e4a1bac0