Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm contemplating writing a script that does this:

  • Goes through each file in /usr/lib
  • Does a dpkg -s search on each file.
  • Reports a list of "orphan" files not belonging to any .deb package.

The idea is that over time, I've installed a lot of make install software and I'd like to get a list of leftover files from manually installed software I've since deleted.

share|improve this question
    
In the future, make sure everything you install outside the packaging system gets installed to /usr/local or /opt. Then you'll have a clear separation. –  geirha Feb 29 '12 at 14:35

2 Answers 2

up vote 1 down vote accepted
find /usr/lib -type f | xargs -n1 dpkg -S | grep 'no path found'

I'll warn you now: it's slow.

share|improve this answer

You can run the following command

join -t '' -v1 <(find /usr/lib | sort) \
               <(grep -h /usr/lib /var/lib/dpkg/info/*.list | sort -u)

that compare the list of files in /usr/lib with the list of files present in at least a file in /var/lib/dpkg/info/<NAME>.list (the files used by dpkg -S). The -v1 option would report files present in the first list but not in the second one.

On my machine this difference list gives more than 5000 hits, so I doubt it could be of any help.

share|improve this answer
    
Works really fast for me. –  user1202136 May 20 at 15:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.