The FreeBSD Diary

The FreeBSD Diary (TM)

Providing practical examples since 1998

If you buy from Amazon USA, please support us by using this link.
FreeBSD Support
 New Topic  |  Go to Top  |  Go to Topic  |  Search  |  Log In   Previous Message  |  Next Message 
 Cleaning junk out of /usr/local
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!

- Justin

 Reply To This Message  |  Forum List  |  Flat View   Newer Topic  |  Older Topic 

 Topics Author  Date
 Cleaning junk out of /usr/local   new
Justin Hawkins 08-09-00 15:18 
 RE: Cleaning junk out of /usr/local   new
Don Brearley 10-09-00 09:08 
 RE: Cleaning junk out of /usr/local   new
Philip 13-09-00 18:09 

 Forum List  |  Need a Login? Register Here 
 User Login
 User Name:
 Remember my login:
 Forgot Your Password?
Enter your email address or user name below and a new password will be sent to the email address associated with your profile.
How to get the most out of the forum