Author: Justin Hawkins
Date: 08-09-00 15:18
It had always concerned me a little about the way stuff accumulates in /usr/local, if you're anything like me you like to experiment, installing bits and pieces here and there, and over time you forget what exactly /usr/local/bin/dowhatsit belongs to.
I thought about it for a while and wondered if there was a way I could find out which files belong to properly installed ports, and what is just stray rubbish. It didn't take me long to hack this together:
[Following should be all on one line]
pkg_info -a -L > /tmp/pkg_info.txt ; for FILE in `find /usr/local -type f` ; do echo -n
$FILE : ; if grep $FILE /tmp/pkg_info.txt > /dev/null ; then echo OK ; else
echo Not in package database ; fi ;done > /tmp/whatswhat.txt
When it's finished you can take a look in /tmp/whatswhat.txt and quickly find those orphaned files.
This is way from perfect (for instance a 'cat' file is created every time you run 'man' and they will show up. This shouldn't be used to blindly delete stuff, more as a guide. If anyone has any suggestions for improving this let me know!