how to find all files NOT part of the installed distro
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
how to find all files NOT part of the installed distro
I loaded a distro (which does not seem relevant) onto my laptop and used it for a while. Applications did whatever they do creating and saving files. I know that I have images and documents and videos and music and such on the laptop among other non-distro data files.
Is there a simple (straightforward) way to identify which files on disk are NOT part of the installed distro?
I know how to use find.
I know that find lets me locate files based on some date-time-stamp.
I know, too, that I can use any selected file as a benchmark date-time instead of some specific command line string. For example:
Code:
Find files whose modification date is before (or after) the date(s) associated with the file /path/foo.bar.
Is there any one file that I could use to peg the distro install date?
Can I get that date from somewhere else like a file system details?
Is there any one file that I could use to peg the distro install date?
Can I get that date from somewhere else like a file system details?
Thanks in advance,
~~~ 0;-Dan
Even if there were a file or method to find the installation time, there's
no guarantee that the packaged file don't have either pre- or even future
dated files distributed. So I really don't believe there's a distro-agnostic
way of doing it; the only "generic" way would be to install something like
tripwire, AIDE, samhain and take a inventory of the box using those; then
you can find what was changed/added at a later time quite easily.
The only sensible way to go about this w/o the above mentioned tools is to
generate a list of distro supplied files, and match that against your reality,
e.g., in RPM based distros:
Timestamp works fine ... If you have a "date line."
Since I need to know this, the obvious thing to do is create that date line
weeks ago when I did the install ... NOT! Now I need to discover how to answer
these questions long after the fact.
Does anyone know an easy way to answer the question: How many files have XYZ attribute(s)? For example
How many files modified/accessed/created after/before XYZ timestamp?
@SaintDanBert: Why do you want to identify the non-distro files? What do you want to achieve? Are you wanting to preserve user data? How much storage space is used on the system? How much storage space do you have for backup?
@SaintDanBert: Why do you want to identify the non-distro files? What do you want to achieve? Are you wanting to preserve user data? How much storage space is used on the system? How much storage space do you have for backup?
I'm going to do a distro upgrade (clean install) and a drive upgrade (more space).
I can grab /home/* and /wrk/* and /root/* and various other places where I know that I've put things over the past year(s). I don't remember everything that I've done and so I'm looking for non-distro files and folders as reminders of things I might have done that I also need to grab.
Now that you force me to think about things a bit more, when I say "non-distro" I'm really trying to indicate ... files that did not install when I spun the distro ISO
and were not a result of update-manager activity ... I need to identify packages that I installed manually (blush) and I've forgotten were extra added later parts so that I can add them after the update and can grab their data before the update.
when I say "non-distro" I'm really trying to indicate ... files that did not install when I spun the distro ISO
and were not a result of update-manager activity ...
As far as I know, everything that comes with the distro is installed via the package manager. Also, most package managers have a command to see which package ownas a file (it's "pacman -Qo") in Arch Linux. Here's what I would do:
Code:
find / -type f | while read file
do
pacman -Qo "${file}" &> /dev/null # replace this with te appropriate command for your package manager
if [ $? '!=' 0 ]
then
echo "${file}"
fi
done
Note that this could take a VERY long time to complete, since you are basically scanning your entire package database for each file on your hard drive. It might not be too hard to add a progress meter to the script, if you like .
EDIT: with progress meter:
Code:
function echo_err
{
echo "$@" 1>&2
}
files=$(find / -type f)
total_files="$(echo "${files}" | wc -l)"
progress=0
echo "${files}" | while read file
do
pacman -Qo "${file}" &> /dev/null # replace this with te appropriate command for your package manager
if [ $? '!=' 0 ]
then
echo "${file}"
fi
progress=$((progress + 1))
echo_err "${progress}/${total_files} ($(( (progress * 100) / total_files ))%) ${file}"
done
echo_err 'Done!'
Last edited by MTK358; 05-25-2011 at 11:51 AM.
Reason: Corrected percentage calculation, I originally forgot that bash only does integers.
In Slackware, anything that isn't part of the install from CD or DVD usually has a suffix, examples:
htop-0.9-x86_64-1_SBo.tgz (SBo, from slackbuilds.org)
vlc-1.1.9-x86_64-1alien.txz (alien = Alien Bob = Eric Hameleers)
As far as I know, everything that comes with the distro is installed via the package manager. Also, most package managers have a command to see which package ownas a file (it's "pacman -Qo") in Arch Linux. Here's what I would do...
I run *-buntu so I'd need to use apt-get or aptitude or synaptic
or dpkg but your "solution" provides a nice specification*.
Thanks,
~~~ 0;-Dan
____________________
* specification -- "Working code makes the best specification."
Corolary to Brooks's Law, "Prepare to throw the first implementation away."
I run *-buntu so I'd need to use apt-get or aptitude or synaptic
or dpkg but your "solution" provides a nice specification*.
Note that if I would really use it, I would make it skip directories that you know you want to or don't want to back up, such as /home /sys, /var, /proc, etc.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.