Re: howto list all non-rpm installed files on system

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Here's a bash one-liner that outputs the filename of every file on /
not part of an rpm. There may be more directories that should be
excluded or filetypes that should be included, depending on what is in
your setup and what you really want to find.

find / -type f -print|grep -v  '^/proc/' |while read file; do rpm -qf
"$file" >/dev/null || echo "$file"; done

Dave

On Sat, Apr 12, 2008 at 10:57 AM, Steve Siegfried <sos@xxxxxxxx> wrote:
>
>  You probably need a script for this... at least I do.
>    > #!/bin/ksh
>    >
>    > DOIT()
>    > {
>    > START=`date "+%d%b%y @ %T"`
>    > echo "### RPM status started on $START, output file = $FN"
>    > echo "+ rpm -qa > /root/RPM-qa"
>    > rpm -qa > /root/RPM-qa
>    > echo "+ sort < /root/RPM-qa > /root/RPM-qa.sorted"
>    > sort < /root/RPM-qa > /root/RPM-qa.sorted
>    > echo "+ cat /root/RPM-qa.sorted | xargs -l1 rpm -qi | grep \"^Name        :\" | awk '{ print \$3 }' > /root/RPM-qa.sorted.basenames"
>    > cat /root/RPM-qa.sorted | xargs -l1 rpm -qi | grep "^Name        :" | awk '{ print $3 }' > /root/RPM-qa.sorted.basenames
>    > echo "+ uniq < /root/RPM-qa.sorted.basenames > RPM-qa.sorted.basenames.uniq"
>    > uniq < /root/RPM-qa.sorted.basenames > RPM-qa.sorted.basenames.uniq
>    > echo "+ diff /root/RPM-qa.sorted.basenames RPM-qa.sorted.basenames.uniq"
>    > diff /root/RPM-qa.sorted.basenames RPM-qa.sorted.basenames.uniq
>    > echo
>    > echo
>    > echo "### Verifying individual packages:"
>    >
>    > for i in `cat /root/RPM-qa.sorted`
>    > do
>    >   j=`echo $i | xargs -l1 rpm -qi | grep "^Name        :" | awk '{ print $3 }'`
>    >   echo "+ rpm -V $j                # ($i)"
>    >   rpm -V $j
>    > done
>    > echo
>    > echo
>    > echo "### Non-RPM files:"
>    > OF=`mktemp /tmp/list.XXXXXX`
>    >
>    > echo "+ rpm -qal | sort | uniq > $OF.rpm"
>    > rpm -qal | sort | uniq > $OF.rpm
>   >> echo "+ find / -print | sort   > $OF.find"
>   >> find / -print | sort   > $OF.find
>    > echo "+ diff $OF.rpm $OF.find | grep '^>' "
>    > diff $OF.rpm $OF.find | grep '^>'
>    > rm $OF.rpm $OF.find $OF
>    >
>    > END=`date "+%d%b%y @ %T"`
>    > echo "### DONE: RPM status started on $START, finished on $END, output file = $FN"
>    > }
>    >
>    > # MAIN Main main
>    >
>    > FN=/root/CHECK_rpm-V/CHECK_rpm-V.`date '+%d%b%y'`
>    > if [ -f $FN ]
>    > then FN=$FN.`date '+%H:%M'`
>    > fi
>    > export FN
>    >
>    >
>    > DOIT | tee $FN
>    > exit 0
>
>  Note that you may want to rewrite the 2 lines prefixed with ">>" to be something more like:
>   >> echo "+ find / -print | egrep -v '^/dev|^/home|^/proc|^/sys|^/tmp' | sort > $OF.find"
>   >> find / -print | egrep -v '^/dev|^/home|^/proc|^/sys|^/tmp' | sort > $OF.find
>  depending on your needs.
>
>  And yeah... it'll take a while to run, too.
>
>  Hope this helps,
>
>  -S
>
>  David Timms wrote:
>  >
>  > Anybody got some good ideas for listing every file on disk that is:
>  > 1. modified from default rpm install {eg config files}
>  > 2. not installed by any rpm
>  > 3. is a config file for a service - eg. web server /etc/httpd/conf.d/
>  > and so on
>  > 4. is user data, config, files.
>  > ?
>  >
>  > The purpose is to determine, say before an upgrade, what files need to
>  > be backed up.
>  >
>  > locate / will give me all files on disk.
>  > rpm -qfa will list all files installed by rpm
>  > rpm -Va will tell files changed from what rpm installed.
>  >
>  > Is there a tool that combines the above already ?
>  >
>  > DaveT.
>  >
>
>  --
>  fedora-list mailing list
>  fedora-list@xxxxxxxxxx
>  To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
>


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux