LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 05-19-2011, 06:04 PM   #1
SaintDanBert
Senior Member
 
Registered: Jan 2009
Location: Austin, TX
Distribution: Mint-17.1 with Cinnamon & KDE
Posts: 1,478
Blog Entries: 3

Rep: Reputation: 95
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?

Thanks in advance,
~~~ 0;-Dan
 
Old 05-19-2011, 08:28 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Quote:
Originally Posted by SaintDanBert View Post

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:
Code:
rpm -ql $( rpm -qa ) | sort -u


Cheers,
Tink
 
Old 05-19-2011, 08:48 PM   #3
jefro
Moderator
 
Registered: Mar 2008
Posts: 15,374

Rep: Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198
The time stamp won't work I'd guess.

I'd make a test install and diff the two.
 
Old 05-23-2011, 11:34 AM   #4
SaintDanBert
Senior Member
 
Registered: Jan 2009
Location: Austin, TX
Distribution: Mint-17.1 with Cinnamon & KDE
Posts: 1,478
Blog Entries: 3

Original Poster
Rep: Reputation: 95
Quote:
Originally Posted by jefro View Post
The time stamp won't work I'd guess.
...
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?
  • How many files not/owned by XYZ user? group?

Thanks in advance,
~~~ 0;-Dan
 
Old 05-23-2011, 12:32 PM   #5
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 720Reputation: 720Reputation: 720Reputation: 720Reputation: 720Reputation: 720Reputation: 720
Quote:
Originally Posted by SaintDanBert View Post
How many files modified/accessed/created after/before XYZ timestamp?
man find
 
Old 05-23-2011, 12:41 PM   #6
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
@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?
 
Old 05-25-2011, 10:46 AM   #7
SaintDanBert
Senior Member
 
Registered: Jan 2009
Location: Austin, TX
Distribution: Mint-17.1 with Cinnamon & KDE
Posts: 1,478
Blog Entries: 3

Original Poster
Rep: Reputation: 95
Quote:
Originally Posted by catkin View Post
@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.

Thanks for forcing me to think,
~~~ 8d;-Dan
 
Old 05-25-2011, 11:24 AM   #8
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 720Reputation: 720Reputation: 720Reputation: 720Reputation: 720Reputation: 720Reputation: 720
Quote:
Originally Posted by SaintDanBert View Post
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 12:51 PM. Reason: Corrected percentage calculation, I originally forgot that bash only does integers.
 
1 members found this post helpful.
Old 05-25-2011, 11:34 AM   #9
brianL
LQ 5k Club
 
Registered: Jan 2006
Location: Oldham, Lancs, England
Distribution: Slackware & Slackware64 14.1
Posts: 7,453
Blog Entries: 55

Rep: Reputation: Disabled
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)
 
Old 05-25-2011, 02:58 PM   #10
SaintDanBert
Senior Member
 
Registered: Jan 2009
Location: Austin, TX
Distribution: Mint-17.1 with Cinnamon & KDE
Posts: 1,478
Blog Entries: 3

Original Poster
Rep: Reputation: 95
re: (BrianL) communication and equals

Never attempt a battle of wits with an unarmed opponent.

Never play leap frog with a unicorn. (grin)

Thanks for the tip,
~~~ 0;-Dan
 
Old 05-25-2011, 08:12 PM   #11
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
Can't resist posting this ....

"Never argue with an idiot. They'll drag you down to their level and beat you with experience"

 
Old 05-25-2011, 08:18 PM   #12
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 720Reputation: 720Reputation: 720Reputation: 720Reputation: 720Reputation: 720Reputation: 720
@ SaintDanBert and chrism01

I don't understand, what is all this about?
 
Old 05-25-2011, 08:20 PM   #13
brianL
LQ 5k Club
 
Registered: Jan 2006
Location: Oldham, Lancs, England
Distribution: Slackware & Slackware64 14.1
Posts: 7,453
Blog Entries: 55

Rep: Reputation: Disabled
Quote:
Originally Posted by SaintDanBert View Post
re: (BrianL) communication and equals
My signature set them off. Sorry.
 
Old 05-25-2011, 10:03 PM   #14
SaintDanBert
Senior Member
 
Registered: Jan 2009
Location: Austin, TX
Distribution: Mint-17.1 with Cinnamon & KDE
Posts: 1,478
Blog Entries: 3

Original Poster
Rep: Reputation: 95
Quote:
Originally Posted by MTK358 View Post
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."
 
Old 05-26-2011, 07:36 AM   #15
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 720Reputation: 720Reputation: 720Reputation: 720Reputation: 720Reputation: 720Reputation: 720
Quote:
Originally Posted by SaintDanBert View Post
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Where can I find the Linux Distro installed on a Eee PC jasonevolve Linux - Newbie 4 04-13-2008 09:32 AM
Installed windows software using wine, now i cant find the files badgerbox76 Linux - General 4 02-18-2006 12:58 AM
Linux Programs and Files: accessible by any installed distro? hanzj Linux - Newbie 10 04-19-2005 07:46 AM
getting frustrated cannot find/open installed files???? kymystic Mandriva 5 03-06-2005 12:49 AM
How can I find if a certain part of Linux is installed? Conpen2000 Linux - Newbie 2 01-07-2004 05:55 PM


All times are GMT -5. The time now is 09:04 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration