[Leaplist] list files not from rpm

Vernon Singleton vsingleton at cfl.rr.com
Fri Feb 6 23:37:39 EST 2009


On Fri, 2009-02-06 at 17:42 -0300, Ingo Claro wrote:
> I'm using centos 5 and wan't to know the files that are not from rpm 
> ... {snipped for brevity} ...
> is there a better way?
> 
> regards,
> Ingo

Here is a short script I just wrote for you.
I called it "filesNotFromRpms.sh":

        #!/bin/bash
                
        updatedb && locate "" | sort > allFiles
                
        rpm -qa | \
        while read f; do rpm -ql $f; done | \
        sort | uniq | \
        grep -v "(contains no files)" > filesFromRpms
                
        comm -3 allFiles filesFromRpms > filesNotFromRpms
        wc -l filesFromRpms filesNotFromRpms
        wc -l allFiles

Here is the output from my sad little computer:

# time ./filesNotFromRpms.sh 
213112 filesFromRpms
619831 filesNotFromRpms
832943 total
832543 allFiles

real	0m41.487s
user	0m33.161s
sys	0m9.268s

I'm not sure why there was a small discrepancy of a few hundred files,
but it runs pretty fast.  The first time I ran it it took about 3
minutes because I had not done an updatedb in a while.  Do you need it
faster?

Hope that helps,
Vernon



-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



More information about the Leaplist mailing list