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

Re: Finding unused packages



On Fri, 19 Apr 2002 17:15:40 +0100, Peter Whysall wrote:

>On Fri, 2002-04-19 at 16:46, Gary Turner wrote:
>> On Fri, 19 Apr 2002 09:59:34 -0400, Noah Meyerhans wrote:
>> 
>> >On Fri, Apr 19, 2002 at 03:00:34PM +0200, Matijs van Zuijlen wrote:

snip
>> This non-hacker is
>> thinking that a script that steps through the various /bin directories,
>> checking and sorting the last access for each file would be what Marijs
>> is looking for. For example,
>> 
>> 	find -atime +30 -maxdepth 1
>> 
>> yields any file in the current directory that hasn't been accessed in
>> the last 30 days.  I would think the next step would be to see which
>> package those long unused binaries belong to.  This I leave as an
>> exercise for the class :^)

>
>Right, I think I'm *nearly* there...
>
>Here we go:
>
>find / -type f -atime +30 | xargs dpkg -S | sort | uniq > old.txt

Try using this only in /bin, /usr/bin, and /usr/local/bin directories,
and set depth to only the one level.  Any app is going to have a binary,
no?  Also, you might try 60 or 90 or even more days old.  I tested in
/usr/bin, and found whoami had not been accessed in last 30 days.  I ran
whoami, then reran the 'find...' command again and whoami was no longer
on the list.
>
>There's an obvious problem - it hits up every file, regardless. I
>certainly haven't accessed a lot of the non-English localisation files
>on my system in like forever, and old.txt is a resultant 700K in size.
>
>What we need to do is tell "find" to only find files that have
>executable bits set, with the -perm switch - however, the following:

If you run only in a bin/ directory, the 'x' bits are set, no need to
screen for non-executables.
>
>find / -type f -atime +30 perm ugo+x | xargs dpkg -S | sort | uniq >
>old.txt 
>
>doesn't return anything. Can someone point out the staggering (yet quite
>invisible to me) stupidity I'm undoubtedly committing?

I couldn't get xargs dpkg -S to return anything, either.  Look at the
output of 'find', it includes the directory.  I would guess that the
filename needs to be extracted before it's given to xargs, to pass to
dpkg.

--
gt
It is interesting to note that as one evil empire (generic) fell,
another Evil Empire (tm)  began its nefarious rise. -- me
Coincidence?  I think not.


-- 
To UNSUBSCRIBE, email to debian-user-request@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: